<html>
<head>
    <title>String.js Source Code | Sencha Test 1.0.3</title>
    <!--  Generated on  -->
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
    <pre class="editor editor-colors"><div class="line"><a name="line1"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line2"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@class</span></span><span>&nbsp;String</span></span></span></div><div class="line"><a name="line3"><a name="String"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line4"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`String`&nbsp;is&nbsp;a&nbsp;global&nbsp;object&nbsp;that&nbsp;may&nbsp;be&nbsp;used&nbsp;to&nbsp;construct&nbsp;String&nbsp;instances.</span></span></span></div><div class="line"><a name="line5"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line6"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;String&nbsp;objects&nbsp;may&nbsp;be&nbsp;created&nbsp;by&nbsp;calling&nbsp;the&nbsp;constructor&nbsp;`new&nbsp;String()`.&nbsp;The&nbsp;`String`&nbsp;object&nbsp;wraps</span></span></span></div><div class="line"><a name="line7"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;JavaScript&#39;s&nbsp;string&nbsp;primitive&nbsp;data&nbsp;type&nbsp;with&nbsp;the&nbsp;methods&nbsp;described&nbsp;below.&nbsp;The&nbsp;global&nbsp;function</span></span></span></div><div class="line"><a name="line8"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`String()`&nbsp;can&nbsp;also&nbsp;be&nbsp;called&nbsp;without&nbsp;new&nbsp;in&nbsp;front&nbsp;to&nbsp;create&nbsp;a&nbsp;primitive&nbsp;string.&nbsp;String&nbsp;literals&nbsp;in</span></span></span></div><div class="line"><a name="line9"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;JavaScript&nbsp;are&nbsp;primitive&nbsp;strings.</span></span></span></div><div class="line"><a name="line10"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line11"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Because&nbsp;JavaScript&nbsp;automatically&nbsp;converts&nbsp;between&nbsp;string&nbsp;primitives&nbsp;and&nbsp;String&nbsp;objects,&nbsp;you&nbsp;can&nbsp;call</span></span></span></div><div class="line"><a name="line12"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;any&nbsp;of&nbsp;the&nbsp;methods&nbsp;of&nbsp;the&nbsp;`String`&nbsp;object&nbsp;on&nbsp;a&nbsp;string&nbsp;primitive.&nbsp;JavaScript&nbsp;automatically&nbsp;converts&nbsp;the</span></span></span></div><div class="line"><a name="line13"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;string&nbsp;primitive&nbsp;to&nbsp;a&nbsp;temporary&nbsp;`String`&nbsp;object,&nbsp;calls&nbsp;the&nbsp;method,&nbsp;then&nbsp;discards&nbsp;the&nbsp;temporary&nbsp;String</span></span></span></div><div class="line"><a name="line14"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;object.&nbsp;For&nbsp;example,&nbsp;you&nbsp;can&nbsp;use&nbsp;the&nbsp;`String.length`&nbsp;property&nbsp;on&nbsp;a&nbsp;string&nbsp;primitive&nbsp;created&nbsp;from&nbsp;a</span></span></span></div><div class="line"><a name="line15"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;string&nbsp;literal:</span></span></span></div><div class="line"><a name="line16"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line17"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s_obj&nbsp;=&nbsp;new&nbsp;String(s_prim&nbsp;=&nbsp;s_also_prim&nbsp;=&nbsp;&quot;foo&quot;);</span></span></span></div><div class="line"><a name="line18"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line19"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s_obj.length;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;3</span></span></span></div><div class="line"><a name="line20"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s_prim.length;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;3</span></span></span></div><div class="line"><a name="line21"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s_also_prim.length;&nbsp;//&nbsp;3</span></span></span></div><div class="line"><a name="line22"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;foo&#39;.length;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;3</span></span></span></div><div class="line"><a name="line23"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;foo&quot;.length;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;3</span></span></span></div><div class="line"><a name="line24"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line25"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;(A&nbsp;string&nbsp;literal&nbsp;is&nbsp;denoted&nbsp;with&nbsp;single&nbsp;or&nbsp;double&nbsp;quotation&nbsp;marks.)</span></span></span></div><div class="line"><a name="line26"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line27"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;String&nbsp;objects&nbsp;can&nbsp;be&nbsp;converted&nbsp;to&nbsp;primitive&nbsp;strings&nbsp;with&nbsp;the&nbsp;`valueOf`&nbsp;method.</span></span></span></div><div class="line"><a name="line28"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line29"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;String&nbsp;primitives&nbsp;and&nbsp;String&nbsp;objects&nbsp;give&nbsp;different&nbsp;results&nbsp;when&nbsp;evaluated&nbsp;as&nbsp;JavaScript.&nbsp;Primitives</span></span></span></div><div class="line"><a name="line30"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;are&nbsp;treated&nbsp;as&nbsp;source&nbsp;code;&nbsp;String&nbsp;objects&nbsp;are&nbsp;treated&nbsp;as&nbsp;a&nbsp;character&nbsp;sequence&nbsp;object.&nbsp;For&nbsp;example:</span></span></span></div><div class="line"><a name="line31"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line32"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s1&nbsp;=&nbsp;&quot;2&nbsp;+&nbsp;2&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;creates&nbsp;a&nbsp;string&nbsp;primitive</span></span></span></div><div class="line"><a name="line33"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s2&nbsp;=&nbsp;new&nbsp;String(&quot;2&nbsp;+&nbsp;2&quot;);&nbsp;&nbsp;&nbsp;//&nbsp;creates&nbsp;a&nbsp;String&nbsp;object</span></span></span></div><div class="line"><a name="line34"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval(s1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;the&nbsp;number&nbsp;4</span></span></span></div><div class="line"><a name="line35"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval(s2);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;the&nbsp;string&nbsp;&quot;2&nbsp;+&nbsp;2&quot;</span></span></span></div><div class="line"><a name="line36"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval(s2.valueOf());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;the&nbsp;number&nbsp;4</span></span></span></div><div class="line"><a name="line37"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line38"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;#&nbsp;Character&nbsp;access</span></span></span></div><div class="line"><a name="line39"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line40"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;There&nbsp;are&nbsp;two&nbsp;ways&nbsp;to&nbsp;access&nbsp;an&nbsp;individual&nbsp;character&nbsp;in&nbsp;a&nbsp;string.&nbsp;The&nbsp;first&nbsp;is&nbsp;the&nbsp;`charAt`&nbsp;method:</span></span></span></div><div class="line"><a name="line41"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line42"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&#39;cat&#39;.charAt(1);&nbsp;//&nbsp;returns&nbsp;&quot;a&quot;</span></span></span></div><div class="line"><a name="line43"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line44"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;other&nbsp;way&nbsp;is&nbsp;to&nbsp;treat&nbsp;the&nbsp;string&nbsp;as&nbsp;an&nbsp;array,&nbsp;where&nbsp;each&nbsp;index&nbsp;corresponds&nbsp;to&nbsp;an&nbsp;individual</span></span></span></div><div class="line"><a name="line45"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;character:</span></span></span></div><div class="line"><a name="line46"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line47"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&#39;cat&#39;[1];&nbsp;//&nbsp;returns&nbsp;&quot;a&quot;</span></span></span></div><div class="line"><a name="line48"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line49"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;second&nbsp;way&nbsp;(treating&nbsp;the&nbsp;string&nbsp;as&nbsp;an&nbsp;array)&nbsp;is&nbsp;not&nbsp;part&nbsp;of&nbsp;ECMAScript&nbsp;3.&nbsp;It&nbsp;is&nbsp;a&nbsp;JavaScript&nbsp;and</span></span></span></div><div class="line"><a name="line50"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;ECMAScript&nbsp;5&nbsp;feature.</span></span></span></div><div class="line"><a name="line51"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line52"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;both&nbsp;cases,&nbsp;attempting&nbsp;to&nbsp;set&nbsp;an&nbsp;individual&nbsp;character&nbsp;won&#39;t&nbsp;work.&nbsp;Trying&nbsp;to&nbsp;set&nbsp;a&nbsp;character</span></span></span></div><div class="line"><a name="line53"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;through&nbsp;`charAt`&nbsp;results&nbsp;in&nbsp;an&nbsp;error,&nbsp;while&nbsp;trying&nbsp;to&nbsp;set&nbsp;a&nbsp;character&nbsp;via&nbsp;indexing&nbsp;does&nbsp;not&nbsp;throw&nbsp;an</span></span></span></div><div class="line"><a name="line54"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;error,&nbsp;but&nbsp;the&nbsp;string&nbsp;itself&nbsp;is&nbsp;unchanged.</span></span></span></div><div class="line"><a name="line55"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line56"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;#&nbsp;Comparing&nbsp;strings</span></span></span></div><div class="line"><a name="line57"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line58"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;C&nbsp;developers&nbsp;have&nbsp;the&nbsp;`strcmp()`&nbsp;function&nbsp;for&nbsp;comparing&nbsp;strings.&nbsp;In&nbsp;JavaScript,&nbsp;you&nbsp;just&nbsp;use&nbsp;the&nbsp;less-</span></span></span></div><div class="line"><a name="line59"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;than&nbsp;and&nbsp;greater-than&nbsp;operators:</span></span></span></div><div class="line"><a name="line60"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line61"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;a&nbsp;=&nbsp;&quot;a&quot;;</span></span></span></div><div class="line"><a name="line62"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;b&nbsp;=&nbsp;&quot;b&quot;;</span></span></span></div><div class="line"><a name="line63"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(a&nbsp;&lt;&nbsp;b)&nbsp;//&nbsp;true</span></span></span></div><div class="line"><a name="line64"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(a&nbsp;+&nbsp;&quot;&nbsp;is&nbsp;less&nbsp;than&nbsp;&quot;&nbsp;+&nbsp;b);</span></span></span></div><div class="line"><a name="line65"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;if&nbsp;(a&nbsp;&gt;&nbsp;b)</span></span></span></div><div class="line"><a name="line66"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(a&nbsp;+&nbsp;&quot;&nbsp;is&nbsp;greater&nbsp;than&nbsp;&quot;&nbsp;+&nbsp;b);</span></span></span></div><div class="line"><a name="line67"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else</span></span></span></div><div class="line"><a name="line68"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(a&nbsp;+&nbsp;&quot;&nbsp;and&nbsp;&quot;&nbsp;+&nbsp;b&nbsp;+&nbsp;&quot;&nbsp;are&nbsp;equal.&quot;);</span></span></span></div><div class="line"><a name="line69"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line70"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;A&nbsp;similar&nbsp;result&nbsp;can&nbsp;be&nbsp;achieved&nbsp;using&nbsp;the&nbsp;`localeCompare`&nbsp;method&nbsp;inherited&nbsp;by&nbsp;`String`&nbsp;instances.</span></span></span></div><div class="line"><a name="line71"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line72"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&lt;div&nbsp;class=&quot;notice&quot;&gt;</span></span></span></div><div class="line"><a name="line73"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Documentation&nbsp;for&nbsp;this&nbsp;class&nbsp;comes&nbsp;from&nbsp;[MDN](</span><span class="markup underline link https hyperlink"><span>https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String</span></span><span>)</span></span></span></div><div class="line"><a name="line74"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;and&nbsp;is&nbsp;available&nbsp;under&nbsp;[Creative&nbsp;Commons:&nbsp;Attribution-Sharealike&nbsp;license](</span><span class="markup underline link http hyperlink"><span>http://creativecommons.org/licenses/by-sa/2.0/</span></span><span>).</span></span></span></div><div class="line"><a name="line75"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&lt;/div&gt;</span></span></span></div><div class="line"><a name="line76"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line77"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line78"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line79"><a name="String-method-constructor"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;constructor</span></span></span></div><div class="line"><a name="line80"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Creates&nbsp;new&nbsp;String&nbsp;object.</span></span></span></div><div class="line"><a name="line81"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Object}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>value</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;value&nbsp;to&nbsp;wrap&nbsp;into&nbsp;String&nbsp;object.</span></span></span></span></span></div><div class="line"><a name="line82"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line83"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line84"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>Methods</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line85"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line86"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line87"><a name="String-method-fromCharCode"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;fromCharCode</span></span></span></div><div class="line"><a name="line88"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;a&nbsp;string&nbsp;created&nbsp;by&nbsp;using&nbsp;the&nbsp;specified&nbsp;sequence&nbsp;of&nbsp;Unicode&nbsp;values.</span></span></span></div><div class="line"><a name="line89"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line90"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;method&nbsp;returns&nbsp;a&nbsp;string&nbsp;and&nbsp;not&nbsp;a&nbsp;`String`&nbsp;object.</span></span></span></div><div class="line"><a name="line91"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line92"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Because&nbsp;`fromCharCode`&nbsp;is&nbsp;a&nbsp;static&nbsp;method&nbsp;of&nbsp;`String`,&nbsp;you&nbsp;always&nbsp;use&nbsp;it&nbsp;as&nbsp;`String.fromCharCode()`,</span></span></span></div><div class="line"><a name="line93"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;rather&nbsp;than&nbsp;as&nbsp;a&nbsp;method&nbsp;of&nbsp;a&nbsp;`String`&nbsp;object&nbsp;you&nbsp;created.</span></span></span></div><div class="line"><a name="line94"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line95"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Although&nbsp;most&nbsp;common&nbsp;Unicode&nbsp;values&nbsp;can&nbsp;be&nbsp;represented&nbsp;in&nbsp;a&nbsp;fixed&nbsp;width&nbsp;system/with&nbsp;one&nbsp;number&nbsp;(as</span></span></span></div><div class="line"><a name="line96"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;expected&nbsp;early&nbsp;on&nbsp;during&nbsp;JavaScript&nbsp;standardization)&nbsp;and&nbsp;`fromCharCode()`&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;return&nbsp;a</span></span></span></div><div class="line"><a name="line97"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;single&nbsp;character&nbsp;for&nbsp;the&nbsp;most&nbsp;common&nbsp;values&nbsp;(i.e.,&nbsp;UCS-2&nbsp;values&nbsp;which&nbsp;are&nbsp;the&nbsp;subset&nbsp;of&nbsp;UTF-16&nbsp;with</span></span></span></div><div class="line"><a name="line98"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;most&nbsp;common&nbsp;characters),&nbsp;in&nbsp;order&nbsp;to&nbsp;deal&nbsp;with&nbsp;ALL&nbsp;legal&nbsp;Unicode&nbsp;values,&nbsp;`fromCharCode()`&nbsp;alone</span></span></span></div><div class="line"><a name="line99"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;inadequate.&nbsp;Since&nbsp;the&nbsp;higher&nbsp;code&nbsp;point&nbsp;characters&nbsp;use&nbsp;two&nbsp;(lower&nbsp;value)&nbsp;&quot;surrogate&quot;&nbsp;numbers&nbsp;to</span></span></span></div><div class="line"><a name="line100"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;form&nbsp;a&nbsp;single&nbsp;character,&nbsp;`fromCharCode()`&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;return&nbsp;such&nbsp;a&nbsp;pair&nbsp;and&nbsp;thus&nbsp;adequately</span></span></span></div><div class="line"><a name="line101"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;represent&nbsp;these&nbsp;higher&nbsp;valued&nbsp;characters.</span></span></span></div><div class="line"><a name="line102"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line103"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Be&nbsp;aware,&nbsp;therefore,&nbsp;that&nbsp;the&nbsp;following&nbsp;utility&nbsp;function&nbsp;to&nbsp;grab&nbsp;the&nbsp;accurate&nbsp;character&nbsp;even&nbsp;for</span></span></span></div><div class="line"><a name="line104"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;higher&nbsp;value&nbsp;code&nbsp;points,&nbsp;may&nbsp;be&nbsp;returning&nbsp;a&nbsp;value&nbsp;which&nbsp;is&nbsp;rendered&nbsp;as&nbsp;a&nbsp;single&nbsp;character,&nbsp;but</span></span></span></div><div class="line"><a name="line105"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;which&nbsp;has&nbsp;a&nbsp;string&nbsp;count&nbsp;of&nbsp;two&nbsp;(though&nbsp;usually&nbsp;the&nbsp;count&nbsp;will&nbsp;be&nbsp;one).</span></span></span></div><div class="line"><a name="line106"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line107"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;String.fromCharCode()&nbsp;alone&nbsp;cannot&nbsp;get&nbsp;the&nbsp;character&nbsp;at&nbsp;such&nbsp;a&nbsp;high&nbsp;code&nbsp;point</span></span></span></div><div class="line"><a name="line108"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;The&nbsp;following,&nbsp;on&nbsp;the&nbsp;other&nbsp;hand,&nbsp;can&nbsp;return&nbsp;a&nbsp;4-byte&nbsp;character&nbsp;as&nbsp;well&nbsp;as&nbsp;the</span></span></span></div><div class="line"><a name="line109"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;usual&nbsp;2-byte&nbsp;ones&nbsp;(i.e.,&nbsp;it&nbsp;can&nbsp;return&nbsp;a&nbsp;single&nbsp;character&nbsp;which&nbsp;actually&nbsp;has</span></span></span></div><div class="line"><a name="line110"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;a&nbsp;string&nbsp;length&nbsp;of&nbsp;2&nbsp;instead&nbsp;of&nbsp;1!)</span></span></span></div><div class="line"><a name="line111"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(fixedFromCharCode(0x2F804));&nbsp;//&nbsp;or&nbsp;194564&nbsp;in&nbsp;decimal</span></span></span></div><div class="line"><a name="line112"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line113"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;fixedFromCharCode&nbsp;(codePt)&nbsp;{</span></span></span></div><div class="line"><a name="line114"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(codePt&nbsp;&gt;&nbsp;0xFFFF)&nbsp;{</span></span></span></div><div class="line"><a name="line115"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;codePt&nbsp;-=&nbsp;0x10000;</span></span></span></div><div class="line"><a name="line116"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;String.fromCharCode(0xD800&nbsp;+&nbsp;(codePt&nbsp;&gt;&gt;&nbsp;10),&nbsp;0xDC00&nbsp;+</span></span></span></div><div class="line"><a name="line117"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(codePt&nbsp;&amp;&nbsp;0x3FF));</span></span></span></div><div class="line"><a name="line118"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line119"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{</span></span></span></div><div class="line"><a name="line120"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;String.fromCharCode(codePt);</span></span></span></div><div class="line"><a name="line121"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line122"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line123"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line124"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;returns&nbsp;the&nbsp;string&nbsp;&quot;ABC&quot;.</span></span></span></div><div class="line"><a name="line125"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line126"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String.fromCharCode(65,66,67)</span></span></span></div><div class="line"><a name="line127"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line128"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{Number...}&nbsp;numbers&nbsp;A&nbsp;sequence&nbsp;of&nbsp;numbers&nbsp;that&nbsp;are&nbsp;Unicode&nbsp;values.</span></span></span></div><div class="line"><a name="line129"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>String</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>containing&nbsp;characters&nbsp;from&nbsp;encoding.</span></span></span></span></span></div><div class="line"><a name="line130"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line131"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line132"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>Properties</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line133"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line134"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line135"><a name="String-property-length"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@property</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>length</span></span><span>&nbsp;</span></span></span></span></div><div class="line"><a name="line136"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Reflects&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line137"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line138"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;property&nbsp;returns&nbsp;the&nbsp;number&nbsp;of&nbsp;code&nbsp;units&nbsp;in&nbsp;the&nbsp;string.&nbsp;UTF-16,&nbsp;the&nbsp;string&nbsp;format&nbsp;used&nbsp;by&nbsp;JavaScript,&nbsp;uses&nbsp;a&nbsp;single&nbsp;16-bit</span></span></span></div><div class="line"><a name="line139"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;code&nbsp;unit&nbsp;to&nbsp;represent&nbsp;the&nbsp;most&nbsp;common&nbsp;characters,&nbsp;but&nbsp;needs&nbsp;to&nbsp;use&nbsp;two&nbsp;code&nbsp;units&nbsp;for&nbsp;less&nbsp;commonly-used&nbsp;characters,&nbsp;so&nbsp;it&#39;s</span></span></span></div><div class="line"><a name="line140"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;possible&nbsp;for&nbsp;the&nbsp;value&nbsp;returned&nbsp;by&nbsp;`length`&nbsp;to&nbsp;not&nbsp;match&nbsp;the&nbsp;actual&nbsp;number&nbsp;of&nbsp;characters&nbsp;in&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line141"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line142"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;For&nbsp;an&nbsp;empty&nbsp;string,&nbsp;`length`&nbsp;is&nbsp;0.</span></span></span></div><div class="line"><a name="line143"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line144"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;x&nbsp;=&nbsp;&quot;Netscape&quot;;</span></span></span></div><div class="line"><a name="line145"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;empty&nbsp;=&nbsp;&quot;&quot;;</span></span></span></div><div class="line"><a name="line146"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line147"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(&quot;Netspace&nbsp;is&nbsp;&quot;&nbsp;+&nbsp;x.length&nbsp;+&nbsp;&quot;&nbsp;code&nbsp;units&nbsp;long&quot;);</span></span></span></div><div class="line"><a name="line148"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(&quot;The&nbsp;empty&nbsp;string&nbsp;is&nbsp;has&nbsp;a&nbsp;length&nbsp;of&nbsp;&quot;&nbsp;+&nbsp;empty.length);&nbsp;//&nbsp;should&nbsp;be&nbsp;0</span></span></span></div><div class="line"><a name="line149"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line150"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line151"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>Methods</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line152"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line153"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line154"><a name="String-method-charAt"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;charAt</span></span></span></div><div class="line"><a name="line155"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;character&nbsp;at&nbsp;the&nbsp;specified&nbsp;index.</span></span></span></div><div class="line"><a name="line156"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line157"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Characters&nbsp;in&nbsp;a&nbsp;string&nbsp;are&nbsp;indexed&nbsp;from&nbsp;left&nbsp;to&nbsp;right.&nbsp;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;character&nbsp;is&nbsp;0,&nbsp;and</span></span></span></div><div class="line"><a name="line158"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;index&nbsp;of&nbsp;the&nbsp;last&nbsp;character&nbsp;in&nbsp;a&nbsp;string&nbsp;called&nbsp;`stringName`&nbsp;is&nbsp;`stringName.length&nbsp;-&nbsp;1`.&nbsp;If&nbsp;the</span></span></span></div><div class="line"><a name="line159"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;index&nbsp;you&nbsp;supply&nbsp;is&nbsp;out&nbsp;of&nbsp;range,&nbsp;JavaScript&nbsp;returns&nbsp;an&nbsp;empty&nbsp;string.</span></span></span></div><div class="line"><a name="line160"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line161"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;displays&nbsp;characters&nbsp;at&nbsp;different&nbsp;locations&nbsp;in&nbsp;the&nbsp;string&nbsp;&quot;Brave&nbsp;new&nbsp;world&quot;:</span></span></span></div><div class="line"><a name="line162"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line163"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;anyString=&quot;Brave&nbsp;new&nbsp;world&quot;;</span></span></span></div><div class="line"><a name="line164"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line165"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;The&nbsp;character&nbsp;at&nbsp;index&nbsp;0&nbsp;is&nbsp;&#39;&quot;&nbsp;+&nbsp;anyString.charAt(0)&nbsp;+&nbsp;&quot;&#39;&quot;);</span></span></span></div><div class="line"><a name="line166"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;The&nbsp;character&nbsp;at&nbsp;index&nbsp;1&nbsp;is&nbsp;&#39;&quot;&nbsp;+&nbsp;anyString.charAt(1)&nbsp;+&nbsp;&quot;&#39;&quot;);</span></span></span></div><div class="line"><a name="line167"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;The&nbsp;character&nbsp;at&nbsp;index&nbsp;2&nbsp;is&nbsp;&#39;&quot;&nbsp;+&nbsp;anyString.charAt(2)&nbsp;+&nbsp;&quot;&#39;&quot;);</span></span></span></div><div class="line"><a name="line168"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;The&nbsp;character&nbsp;at&nbsp;index&nbsp;3&nbsp;is&nbsp;&#39;&quot;&nbsp;+&nbsp;anyString.charAt(3)&nbsp;+&nbsp;&quot;&#39;&quot;);</span></span></span></div><div class="line"><a name="line169"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;The&nbsp;character&nbsp;at&nbsp;index&nbsp;4&nbsp;is&nbsp;&#39;&quot;&nbsp;+&nbsp;anyString.charAt(4)&nbsp;+&nbsp;&quot;&#39;&quot;);</span></span></span></div><div class="line"><a name="line170"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;The&nbsp;character&nbsp;at&nbsp;index&nbsp;999&nbsp;is&nbsp;&#39;&quot;&nbsp;+&nbsp;anyString.charAt(999)&nbsp;+&nbsp;&quot;&#39;&quot;);</span></span></span></div><div class="line"><a name="line171"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line172"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;These&nbsp;lines&nbsp;display&nbsp;the&nbsp;following:</span></span></span></div><div class="line"><a name="line173"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line174"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;character&nbsp;at&nbsp;index&nbsp;0&nbsp;is&nbsp;&#39;B&#39;</span></span></span></div><div class="line"><a name="line175"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;character&nbsp;at&nbsp;index&nbsp;1&nbsp;is&nbsp;&#39;r&#39;</span></span></span></div><div class="line"><a name="line176"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;character&nbsp;at&nbsp;index&nbsp;2&nbsp;is&nbsp;&#39;a&#39;</span></span></span></div><div class="line"><a name="line177"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;character&nbsp;at&nbsp;index&nbsp;3&nbsp;is&nbsp;&#39;v&#39;</span></span></span></div><div class="line"><a name="line178"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;character&nbsp;at&nbsp;index&nbsp;4&nbsp;is&nbsp;&#39;e&#39;</span></span></span></div><div class="line"><a name="line179"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;character&nbsp;at&nbsp;index&nbsp;999&nbsp;is&nbsp;&#39;&#39;</span></span></span></div><div class="line"><a name="line180"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line181"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;provides&nbsp;a&nbsp;means&nbsp;of&nbsp;ensuring&nbsp;that&nbsp;going&nbsp;through&nbsp;a&nbsp;string&nbsp;loop&nbsp;always&nbsp;provides&nbsp;a&nbsp;whole</span></span></span></div><div class="line"><a name="line182"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;character,&nbsp;even&nbsp;if&nbsp;the&nbsp;string&nbsp;contains&nbsp;characters&nbsp;that&nbsp;are&nbsp;not&nbsp;in&nbsp;the&nbsp;Basic&nbsp;Multi-lingual&nbsp;Plane.</span></span></span></div><div class="line"><a name="line183"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line184"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str&nbsp;=&nbsp;&#39;A\uD87E\uDC04Z&#39;;&nbsp;//&nbsp;We&nbsp;could&nbsp;also&nbsp;use&nbsp;a&nbsp;non-BMP&nbsp;character&nbsp;directly</span></span></span></div><div class="line"><a name="line185"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;i=0,&nbsp;chr;&nbsp;i&nbsp;&lt;&nbsp;str.length;&nbsp;i++)&nbsp;{</span></span></span></div><div class="line"><a name="line186"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;((chr&nbsp;=&nbsp;getWholeChar(str,&nbsp;i))&nbsp;===&nbsp;false)&nbsp;{continue;}&nbsp;//&nbsp;Adapt&nbsp;this&nbsp;line&nbsp;at&nbsp;the&nbsp;top&nbsp;of</span></span></span></div><div class="line"><a name="line187"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;each&nbsp;loop,&nbsp;passing&nbsp;in&nbsp;the&nbsp;whole&nbsp;string&nbsp;and&nbsp;the&nbsp;current&nbsp;iteration&nbsp;and&nbsp;returning&nbsp;a&nbsp;variable&nbsp;to</span></span></span></div><div class="line"><a name="line188"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;represent&nbsp;the&nbsp;individual&nbsp;character</span></span></span></div><div class="line"><a name="line189"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(chr);</span></span></span></div><div class="line"><a name="line190"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line191"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line192"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;getWholeChar&nbsp;(str,&nbsp;i)&nbsp;{</span></span></span></div><div class="line"><a name="line193"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;code&nbsp;=&nbsp;str.charCodeAt(i);</span></span></span></div><div class="line"><a name="line194"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line195"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isNaN(code))&nbsp;{</span></span></span></div><div class="line"><a name="line196"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&#39;&#39;;&nbsp;//&nbsp;Position&nbsp;not&nbsp;found</span></span></span></div><div class="line"><a name="line197"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line198"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(code&nbsp;&lt;&nbsp;0xD800&nbsp;||&nbsp;code&nbsp;&gt;&nbsp;0xDFFF)&nbsp;{</span></span></span></div><div class="line"><a name="line199"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;str.charAt(i);</span></span></span></div><div class="line"><a name="line200"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line201"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(0xD800&nbsp;&lt;=&nbsp;code&nbsp;&amp;&amp;&nbsp;code&nbsp;&lt;=&nbsp;0xDBFF)&nbsp;{&nbsp;//&nbsp;High&nbsp;surrogate&nbsp;(could&nbsp;change&nbsp;last&nbsp;hex&nbsp;to&nbsp;0xDB7F</span></span></span></div><div class="line"><a name="line202"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;to&nbsp;treat&nbsp;high&nbsp;private&nbsp;surrogates&nbsp;as&nbsp;single&nbsp;characters)</span></span></span></div><div class="line"><a name="line203"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(str.length&nbsp;&lt;=&nbsp;(i+1))&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line204"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;&#39;High&nbsp;surrogate&nbsp;without&nbsp;following&nbsp;low&nbsp;surrogate&#39;;</span></span></span></div><div class="line"><a name="line205"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line206"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;next&nbsp;=&nbsp;str.charCodeAt(i+1);</span></span></span></div><div class="line"><a name="line207"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(0xDC00&nbsp;&gt;&nbsp;next&nbsp;||&nbsp;next&nbsp;&gt;&nbsp;0xDFFF)&nbsp;{</span></span></span></div><div class="line"><a name="line208"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;&#39;High&nbsp;surrogate&nbsp;without&nbsp;following&nbsp;low&nbsp;surrogate&#39;;</span></span></span></div><div class="line"><a name="line209"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line210"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;str.charAt(i)+str.charAt(i+1);</span></span></span></div><div class="line"><a name="line211"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line212"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Low&nbsp;surrogate&nbsp;(0xDC00&nbsp;&lt;=&nbsp;code&nbsp;&amp;&amp;&nbsp;code&nbsp;&lt;=&nbsp;0xDFFF)</span></span></span></div><div class="line"><a name="line213"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(i&nbsp;===&nbsp;0)&nbsp;{</span></span></span></div><div class="line"><a name="line214"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;&#39;Low&nbsp;surrogate&nbsp;without&nbsp;preceding&nbsp;high&nbsp;surrogate&#39;;</span></span></span></div><div class="line"><a name="line215"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line216"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;prev&nbsp;=&nbsp;str.charCodeAt(i-1);</span></span></span></div><div class="line"><a name="line217"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(0xD800&nbsp;&gt;&nbsp;prev&nbsp;||&nbsp;prev&nbsp;&gt;&nbsp;0xDBFF)&nbsp;{&nbsp;//&nbsp;(could&nbsp;change&nbsp;last&nbsp;hex&nbsp;to&nbsp;0xDB7F&nbsp;to&nbsp;treat&nbsp;high&nbsp;private</span></span></span></div><div class="line"><a name="line218"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;surrogates&nbsp;as&nbsp;single&nbsp;characters)</span></span></span></div><div class="line"><a name="line219"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;&#39;Low&nbsp;surrogate&nbsp;without&nbsp;preceding&nbsp;high&nbsp;surrogate&#39;;</span></span></span></div><div class="line"><a name="line220"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line221"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;&nbsp;//&nbsp;We&nbsp;can&nbsp;pass&nbsp;over&nbsp;low&nbsp;surrogates&nbsp;now&nbsp;as&nbsp;the&nbsp;second&nbsp;component&nbsp;in&nbsp;a&nbsp;pair&nbsp;which&nbsp;we</span></span></span></div><div class="line"><a name="line222"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;have&nbsp;already&nbsp;processed</span></span></span></div><div class="line"><a name="line223"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;}</span></span></span></div><div class="line"><a name="line224"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line225"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;While&nbsp;the&nbsp;second&nbsp;example&nbsp;may&nbsp;be&nbsp;more&nbsp;frequently&nbsp;useful&nbsp;for&nbsp;those&nbsp;wishing&nbsp;to&nbsp;support&nbsp;non-BMP</span></span></span></div><div class="line"><a name="line226"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;characters&nbsp;(since&nbsp;the&nbsp;above&nbsp;does&nbsp;not&nbsp;require&nbsp;the&nbsp;caller&nbsp;to&nbsp;know&nbsp;where&nbsp;any&nbsp;non-BMP&nbsp;character&nbsp;might</span></span></span></div><div class="line"><a name="line227"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;appear),&nbsp;in&nbsp;the&nbsp;event&nbsp;that&nbsp;one&nbsp;_does_&nbsp;wish,&nbsp;in&nbsp;choosing&nbsp;a&nbsp;character&nbsp;by&nbsp;index,&nbsp;to&nbsp;treat&nbsp;the&nbsp;surrogate</span></span></span></div><div class="line"><a name="line228"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;pairs&nbsp;within&nbsp;a&nbsp;string&nbsp;as&nbsp;the&nbsp;single&nbsp;characters&nbsp;they&nbsp;represent,&nbsp;one&nbsp;can&nbsp;use&nbsp;the&nbsp;following:</span></span></span></div><div class="line"><a name="line229"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line230"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;fixedCharAt&nbsp;(str,&nbsp;idx)&nbsp;{</span></span></span></div><div class="line"><a name="line231"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;ret&nbsp;=&nbsp;&#39;&#39;;</span></span></span></div><div class="line"><a name="line232"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;+=&nbsp;&#39;&#39;;</span></span></span></div><div class="line"><a name="line233"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;end&nbsp;=&nbsp;str.length;</span></span></span></div><div class="line"><a name="line234"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line235"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;surrogatePairs&nbsp;=&nbsp;/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;</span></span></span></div><div class="line"><a name="line236"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((surrogatePairs.exec(str))&nbsp;!=&nbsp;null)&nbsp;{</span></span></span></div><div class="line"><a name="line237"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;li&nbsp;=&nbsp;surrogatePairs.lastIndex;</span></span></span></div><div class="line"><a name="line238"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(li&nbsp;-&nbsp;2&nbsp;&lt;&nbsp;idx)&nbsp;{</span></span></span></div><div class="line"><a name="line239"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;idx++;</span></span></span></div><div class="line"><a name="line240"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line241"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{</span></span></span></div><div class="line"><a name="line242"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></span></span></div><div class="line"><a name="line243"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line244"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line245"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line246"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(idx&nbsp;&gt;=&nbsp;end&nbsp;||&nbsp;idx&nbsp;&lt;&nbsp;0)&nbsp;{</span></span></span></div><div class="line"><a name="line247"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&#39;&#39;;</span></span></span></div><div class="line"><a name="line248"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line249"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line250"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret&nbsp;+=&nbsp;str.charAt(idx);</span></span></span></div><div class="line"><a name="line251"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line252"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(/[\uD800-\uDBFF]/.test(ret)&nbsp;&amp;&amp;&nbsp;/[\uDC00-\uDFFF]/.test(str.charAt(idx+1)))&nbsp;{</span></span></span></div><div class="line"><a name="line253"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret&nbsp;+=&nbsp;str.charAt(idx+1);&nbsp;//&nbsp;Go&nbsp;one&nbsp;further,&nbsp;since&nbsp;one&nbsp;of&nbsp;the&nbsp;&quot;characters&quot;&nbsp;is&nbsp;part&nbsp;of&nbsp;a</span></span></span></div><div class="line"><a name="line254"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;surrogate&nbsp;pair</span></span></span></div><div class="line"><a name="line255"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line256"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;ret;</span></span></span></div><div class="line"><a name="line257"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line258"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line259"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>index</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>An&nbsp;integer&nbsp;between&nbsp;0&nbsp;and&nbsp;1&nbsp;less&nbsp;than&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.</span></span></span></span></span></div><div class="line"><a name="line260"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Individual</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>character&nbsp;from&nbsp;string.</span></span></span></span></span></div><div class="line"><a name="line261"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line262"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line263"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line264"><a name="String-method-charCodeAt"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;charCodeAt</span></span></span></div><div class="line"><a name="line265"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;a&nbsp;number&nbsp;indicating&nbsp;the&nbsp;Unicode&nbsp;value&nbsp;of&nbsp;the&nbsp;character&nbsp;at&nbsp;the&nbsp;given&nbsp;index.</span></span></span></div><div class="line"><a name="line266"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line267"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Unicode&nbsp;code&nbsp;points&nbsp;range&nbsp;from&nbsp;0&nbsp;to&nbsp;1,114,111.&nbsp;The&nbsp;first&nbsp;128&nbsp;Unicode&nbsp;code&nbsp;points&nbsp;are&nbsp;a&nbsp;direct&nbsp;match</span></span></span></div><div class="line"><a name="line268"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;of&nbsp;the&nbsp;ASCII&nbsp;character&nbsp;encoding.</span></span></span></div><div class="line"><a name="line269"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line270"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Note&nbsp;that&nbsp;`charCodeAt`&nbsp;will&nbsp;always&nbsp;return&nbsp;a&nbsp;value&nbsp;that&nbsp;is&nbsp;less&nbsp;than&nbsp;65,536.&nbsp;This&nbsp;is&nbsp;because&nbsp;the</span></span></span></div><div class="line"><a name="line271"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;higher&nbsp;code&nbsp;points&nbsp;are&nbsp;represented&nbsp;by&nbsp;a&nbsp;pair&nbsp;of&nbsp;(lower&nbsp;valued)&nbsp;&quot;surrogate&quot;&nbsp;pseudo-characters&nbsp;which</span></span></span></div><div class="line"><a name="line272"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;are&nbsp;used&nbsp;to&nbsp;comprise&nbsp;the&nbsp;real&nbsp;character.&nbsp;Because&nbsp;of&nbsp;this,&nbsp;in&nbsp;order&nbsp;to&nbsp;examine&nbsp;or&nbsp;reproduce&nbsp;the&nbsp;full</span></span></span></div><div class="line"><a name="line273"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;character&nbsp;for&nbsp;individual&nbsp;characters&nbsp;of&nbsp;value&nbsp;65,536&nbsp;and&nbsp;above,&nbsp;for&nbsp;such&nbsp;characters,&nbsp;it&nbsp;is&nbsp;necessary</span></span></span></div><div class="line"><a name="line274"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;to&nbsp;retrieve&nbsp;not&nbsp;only&nbsp;`charCodeAt(i)`,&nbsp;but&nbsp;also&nbsp;`charCodeAt(i+1)`&nbsp;(as&nbsp;if&nbsp;examining/reproducing&nbsp;a</span></span></span></div><div class="line"><a name="line275"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;string&nbsp;with&nbsp;two&nbsp;letters).&nbsp;See&nbsp;example&nbsp;2&nbsp;and&nbsp;3&nbsp;below.</span></span></span></div><div class="line"><a name="line276"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line277"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`charCodeAt`&nbsp;returns&nbsp;`NaN`&nbsp;if&nbsp;the&nbsp;given&nbsp;index&nbsp;is&nbsp;not&nbsp;greater&nbsp;than&nbsp;0&nbsp;or&nbsp;is&nbsp;greater&nbsp;than&nbsp;the&nbsp;length&nbsp;of</span></span></span></div><div class="line"><a name="line278"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line279"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line280"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Backward&nbsp;Compatibility&nbsp;with&nbsp;JavaScript&nbsp;1.2</span></span></span></div><div class="line"><a name="line281"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line282"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`charCodeAt`&nbsp;method&nbsp;returns&nbsp;a&nbsp;number&nbsp;indicating&nbsp;the&nbsp;ISO-Latin-1&nbsp;codeset&nbsp;value&nbsp;of&nbsp;the&nbsp;character</span></span></span></div><div class="line"><a name="line283"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;at&nbsp;the&nbsp;given&nbsp;index.&nbsp;The&nbsp;ISO-Latin-1&nbsp;codeset&nbsp;ranges&nbsp;from&nbsp;0&nbsp;to&nbsp;255.&nbsp;The&nbsp;first&nbsp;0&nbsp;to&nbsp;127&nbsp;are&nbsp;a&nbsp;direct</span></span></span></div><div class="line"><a name="line284"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;match&nbsp;of&nbsp;the&nbsp;ASCII&nbsp;character&nbsp;set.</span></span></span></div><div class="line"><a name="line285"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line286"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Example&nbsp;1:&nbsp;Using&nbsp;`charCodeAt`</span></span></span></div><div class="line"><a name="line287"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line288"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;returns&nbsp;65,&nbsp;the&nbsp;Unicode&nbsp;value&nbsp;for&nbsp;A.</span></span></span></div><div class="line"><a name="line289"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line290"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&quot;ABC&quot;.charCodeAt(0)&nbsp;//&nbsp;returns&nbsp;65</span></span></span></div><div class="line"><a name="line291"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line292"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Example&nbsp;2:&nbsp;Fixing&nbsp;`charCodeAt`&nbsp;to&nbsp;handle&nbsp;non-Basic-Multilingual-Plane&nbsp;characters&nbsp;if&nbsp;their&nbsp;presence</span></span></span></div><div class="line"><a name="line293"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;earlier&nbsp;in&nbsp;the&nbsp;string&nbsp;is&nbsp;unknown</span></span></span></div><div class="line"><a name="line294"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line295"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;version&nbsp;might&nbsp;be&nbsp;used&nbsp;in&nbsp;for&nbsp;loops&nbsp;and&nbsp;the&nbsp;like&nbsp;when&nbsp;it&nbsp;is&nbsp;unknown&nbsp;whether&nbsp;non-BMP&nbsp;characters</span></span></span></div><div class="line"><a name="line296"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;exist&nbsp;before&nbsp;the&nbsp;specified&nbsp;index&nbsp;position.</span></span></span></div><div class="line"><a name="line297"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line298"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;fixedCharCodeAt&nbsp;(str,&nbsp;idx)&nbsp;{</span></span></span></div><div class="line"><a name="line299"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;ex.&nbsp;fixedCharCodeAt&nbsp;(&#39;\uD800\uDC00&#39;,&nbsp;0);&nbsp;//&nbsp;65536</span></span></span></div><div class="line"><a name="line300"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;ex.&nbsp;fixedCharCodeAt&nbsp;(&#39;\uD800\uDC00&#39;,&nbsp;1);&nbsp;//&nbsp;65536</span></span></span></div><div class="line"><a name="line301"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;idx&nbsp;=&nbsp;idx&nbsp;||&nbsp;0;</span></span></span></div><div class="line"><a name="line302"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;code&nbsp;=&nbsp;str.charCodeAt(idx);</span></span></span></div><div class="line"><a name="line303"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;hi,&nbsp;low;</span></span></span></div><div class="line"><a name="line304"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(0xD800&nbsp;&lt;=&nbsp;code&nbsp;&amp;&amp;&nbsp;code&nbsp;&lt;=&nbsp;0xDBFF)&nbsp;{&nbsp;//&nbsp;High&nbsp;surrogate&nbsp;(could&nbsp;change&nbsp;last&nbsp;hex&nbsp;to&nbsp;0xDB7F&nbsp;to&nbsp;treat&nbsp;high&nbsp;private&nbsp;surrogates&nbsp;as&nbsp;single&nbsp;characters)</span></span></span></div><div class="line"><a name="line305"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hi&nbsp;=&nbsp;code;</span></span></span></div><div class="line"><a name="line306"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;low&nbsp;=&nbsp;str.charCodeAt(idx+1);</span></span></span></div><div class="line"><a name="line307"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(isNaN(low))&nbsp;{</span></span></span></div><div class="line"><a name="line308"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;&#39;High&nbsp;surrogate&nbsp;not&nbsp;followed&nbsp;by&nbsp;low&nbsp;surrogate&nbsp;in&nbsp;fixedCharCodeAt()&#39;;</span></span></span></div><div class="line"><a name="line309"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line310"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;((hi&nbsp;-&nbsp;0xD800)&nbsp;*&nbsp;0x400)&nbsp;+&nbsp;(low&nbsp;-&nbsp;0xDC00)&nbsp;+&nbsp;0x10000;</span></span></span></div><div class="line"><a name="line311"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line312"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(0xDC00&nbsp;&lt;=&nbsp;code&nbsp;&amp;&amp;&nbsp;code&nbsp;&lt;=&nbsp;0xDFFF)&nbsp;{&nbsp;//&nbsp;Low&nbsp;surrogate</span></span></span></div><div class="line"><a name="line313"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;We&nbsp;return&nbsp;false&nbsp;to&nbsp;allow&nbsp;loops&nbsp;to&nbsp;skip&nbsp;this&nbsp;iteration&nbsp;since&nbsp;should&nbsp;have&nbsp;already&nbsp;handled</span></span></span></div><div class="line"><a name="line314"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;high&nbsp;surrogate&nbsp;above&nbsp;in&nbsp;the&nbsp;previous&nbsp;iteration</span></span></span></div><div class="line"><a name="line315"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;</span></span></span></div><div class="line"><a name="line316"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line317"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;code;</span></span></span></div><div class="line"><a name="line318"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line319"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line320"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Example&nbsp;3:&nbsp;Fixing&nbsp;`charCodeAt`&nbsp;to&nbsp;handle&nbsp;non-Basic-Multilingual-Plane&nbsp;characters&nbsp;if&nbsp;their&nbsp;presence</span></span></span></div><div class="line"><a name="line321"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;earlier&nbsp;in&nbsp;the&nbsp;string&nbsp;is&nbsp;known</span></span></span></div><div class="line"><a name="line322"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line323"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;knownCharCodeAt&nbsp;(str,&nbsp;idx)&nbsp;{</span></span></span></div><div class="line"><a name="line324"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;+=&nbsp;&#39;&#39;;</span></span></span></div><div class="line"><a name="line325"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;code,</span></span></span></div><div class="line"><a name="line326"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;=&nbsp;str.length;</span></span></span></div><div class="line"><a name="line327"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line328"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;surrogatePairs&nbsp;=&nbsp;/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;</span></span></span></div><div class="line"><a name="line329"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((surrogatePairs.exec(str))&nbsp;!=&nbsp;null)&nbsp;{</span></span></span></div><div class="line"><a name="line330"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;li&nbsp;=&nbsp;surrogatePairs.lastIndex;</span></span></span></div><div class="line"><a name="line331"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(li&nbsp;-&nbsp;2&nbsp;&lt;&nbsp;idx)&nbsp;{</span></span></span></div><div class="line"><a name="line332"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;idx++;</span></span></span></div><div class="line"><a name="line333"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line334"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{</span></span></span></div><div class="line"><a name="line335"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></span></span></div><div class="line"><a name="line336"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line337"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line338"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line339"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(idx&nbsp;&gt;=&nbsp;end&nbsp;||&nbsp;idx&nbsp;&lt;&nbsp;0)&nbsp;{</span></span></span></div><div class="line"><a name="line340"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;NaN;</span></span></span></div><div class="line"><a name="line341"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line342"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line343"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;code&nbsp;=&nbsp;str.charCodeAt(idx);</span></span></span></div><div class="line"><a name="line344"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line345"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;hi,&nbsp;low;</span></span></span></div><div class="line"><a name="line346"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(0xD800&nbsp;&lt;=&nbsp;code&nbsp;&amp;&amp;&nbsp;code&nbsp;&lt;=&nbsp;0xDBFF)&nbsp;{</span></span></span></div><div class="line"><a name="line347"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hi&nbsp;=&nbsp;code;</span></span></span></div><div class="line"><a name="line348"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;low&nbsp;=&nbsp;str.charCodeAt(idx+1);&nbsp;//&nbsp;Go&nbsp;one&nbsp;further,&nbsp;since&nbsp;one&nbsp;of&nbsp;the&nbsp;&quot;characters&quot;&nbsp;is&nbsp;part&nbsp;of</span></span></span></div><div class="line"><a name="line349"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;a&nbsp;surrogate&nbsp;pair</span></span></span></div><div class="line"><a name="line350"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;((hi&nbsp;-&nbsp;0xD800)&nbsp;*&nbsp;0x400)&nbsp;+&nbsp;(low&nbsp;-&nbsp;0xDC00)&nbsp;+&nbsp;0x10000;</span></span></span></div><div class="line"><a name="line351"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line352"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;code;</span></span></span></div><div class="line"><a name="line353"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line354"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line355"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>index</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>An&nbsp;integer&nbsp;greater&nbsp;than&nbsp;0&nbsp;and&nbsp;less&nbsp;than&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string;&nbsp;if&nbsp;it&nbsp;is</span></span></span></span></span></div><div class="line"><a name="line356"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;not&nbsp;a&nbsp;number,&nbsp;it&nbsp;defaults&nbsp;to&nbsp;0.</span></span></span></div><div class="line"><a name="line357"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Value</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>between&nbsp;0&nbsp;and&nbsp;65535.</span></span></span></span></span></div><div class="line"><a name="line358"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line359"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line360"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line361"><a name="String-method-concat"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;concat</span></span></span></div><div class="line"><a name="line362"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Combines&nbsp;combines&nbsp;the&nbsp;text&nbsp;from&nbsp;one&nbsp;or&nbsp;more&nbsp;strings&nbsp;and&nbsp;returns&nbsp;a&nbsp;new&nbsp;string.&nbsp;Changes&nbsp;to&nbsp;the&nbsp;text&nbsp;in</span></span></span></div><div class="line"><a name="line363"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;one&nbsp;string&nbsp;do&nbsp;not&nbsp;affect&nbsp;the&nbsp;other&nbsp;string.</span></span></span></div><div class="line"><a name="line364"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line365"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;combines&nbsp;strings&nbsp;into&nbsp;a&nbsp;new&nbsp;string.</span></span></span></div><div class="line"><a name="line366"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line367"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;hello&nbsp;=&nbsp;&quot;Hello,&nbsp;&quot;;</span></span></span></div><div class="line"><a name="line368"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(hello.concat(&quot;Kevin&quot;,&nbsp;&quot;&nbsp;have&nbsp;a&nbsp;nice&nbsp;day.&quot;));&nbsp;//&nbsp;Hello,&nbsp;Kevin&nbsp;have&nbsp;a&nbsp;nice&nbsp;day.</span></span></span></div><div class="line"><a name="line369"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line370"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{String...}&nbsp;strings&nbsp;The&nbsp;strings&nbsp;to&nbsp;concatenate.</span></span></span></div><div class="line"><a name="line371"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Result</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>of&nbsp;both&nbsp;strings.</span></span></span></span></span></div><div class="line"><a name="line372"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line373"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line374"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line375"><a name="String-method-indexOf"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;indexOf</span></span></span></div><div class="line"><a name="line376"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;index&nbsp;within&nbsp;the&nbsp;calling&nbsp;`String`&nbsp;object&nbsp;of&nbsp;the&nbsp;first&nbsp;occurrence&nbsp;of&nbsp;the&nbsp;specified&nbsp;value,</span></span></span></div><div class="line"><a name="line377"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;or&nbsp;-1&nbsp;if&nbsp;not&nbsp;found.</span></span></span></div><div class="line"><a name="line378"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line379"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Characters&nbsp;in&nbsp;a&nbsp;string&nbsp;are&nbsp;indexed&nbsp;from&nbsp;left&nbsp;to&nbsp;right.&nbsp;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;character&nbsp;is&nbsp;0,&nbsp;and&nbsp;the&nbsp;index&nbsp;of&nbsp;the&nbsp;last&nbsp;character</span></span></span></div><div class="line"><a name="line380"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;of&nbsp;a&nbsp;string&nbsp;called&nbsp;`stringName`&nbsp;is&nbsp;`stringName.length&nbsp;-&nbsp;1`.</span></span></span></div><div class="line"><a name="line381"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line382"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;Blue&quot;)&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;0</span></span></span></div><div class="line"><a name="line383"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;Blute&quot;)&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;-1</span></span></span></div><div class="line"><a name="line384"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;Whale&quot;,0)&nbsp;//&nbsp;returns&nbsp;5</span></span></span></div><div class="line"><a name="line385"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;Whale&quot;,5)&nbsp;//&nbsp;returns&nbsp;5</span></span></span></div><div class="line"><a name="line386"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;&quot;,9)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;9</span></span></span></div><div class="line"><a name="line387"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;&quot;,10)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;10</span></span></span></div><div class="line"><a name="line388"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;&quot;,11)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;10</span></span></span></div><div class="line"><a name="line389"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line390"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`indexOf`&nbsp;method&nbsp;is&nbsp;case&nbsp;sensitive.&nbsp;For&nbsp;example,&nbsp;the&nbsp;following&nbsp;expression&nbsp;returns&nbsp;-1:</span></span></span></div><div class="line"><a name="line391"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line392"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;blue&quot;)</span></span></span></div><div class="line"><a name="line393"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line394"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Note&nbsp;that&nbsp;&#39;0&#39;&nbsp;doesn&#39;t&nbsp;evaluate&nbsp;to&nbsp;true&nbsp;and&nbsp;&#39;-1&#39;&nbsp;doesn&#39;t&nbsp;evaluate&nbsp;to&nbsp;false.&nbsp;Therefore,&nbsp;when&nbsp;checking&nbsp;if&nbsp;a&nbsp;specific&nbsp;string&nbsp;exists</span></span></span></div><div class="line"><a name="line395"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;within&nbsp;another&nbsp;string&nbsp;the&nbsp;correct&nbsp;way&nbsp;to&nbsp;check&nbsp;would&nbsp;be:</span></span></span></div><div class="line"><a name="line396"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line397"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;Blue&quot;)&nbsp;!=&nbsp;-1&nbsp;//&nbsp;true</span></span></span></div><div class="line"><a name="line398"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale&quot;.indexOf(&quot;Bloe&quot;)&nbsp;!=&nbsp;-1&nbsp;//&nbsp;false</span></span></span></div><div class="line"><a name="line399"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line400"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;uses&nbsp;indexOf&nbsp;and&nbsp;lastIndexOf&nbsp;to&nbsp;locate&nbsp;values&nbsp;in&nbsp;the&nbsp;string&nbsp;&quot;Brave&nbsp;new&nbsp;world&quot;.</span></span></span></div><div class="line"><a name="line401"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line402"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;anyString=&quot;Brave&nbsp;new&nbsp;world&quot;</span></span></span></div><div class="line"><a name="line403"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line404"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;w&nbsp;from&nbsp;the&nbsp;beginning&nbsp;is&nbsp;&quot;&nbsp;+&nbsp;anyString.indexOf(&quot;w&quot;))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;8</span></span></span></div><div class="line"><a name="line405"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;w&nbsp;from&nbsp;the&nbsp;end&nbsp;is&nbsp;&quot;&nbsp;+&nbsp;anyString.lastIndexOf(&quot;w&quot;))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;10</span></span></span></div><div class="line"><a name="line406"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;&#39;new&#39;&nbsp;from&nbsp;the&nbsp;beginning&nbsp;is&nbsp;&quot;&nbsp;+&nbsp;anyString.indexOf(&quot;new&quot;))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;6</span></span></span></div><div class="line"><a name="line407"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;&#39;new&#39;&nbsp;from&nbsp;the&nbsp;end&nbsp;is&nbsp;&quot;&nbsp;+&nbsp;anyString.lastIndexOf(&quot;new&quot;))&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;6</span></span></span></div><div class="line"><a name="line408"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line409"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;defines&nbsp;two&nbsp;string&nbsp;variables.&nbsp;The&nbsp;variables&nbsp;contain&nbsp;the&nbsp;same&nbsp;string&nbsp;except&nbsp;that&nbsp;the&nbsp;second&nbsp;string&nbsp;contains</span></span></span></div><div class="line"><a name="line410"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;uppercase&nbsp;letters.&nbsp;The&nbsp;first&nbsp;`writeln`&nbsp;method&nbsp;displays&nbsp;19.&nbsp;But&nbsp;because&nbsp;the&nbsp;`indexOf`&nbsp;method&nbsp;is&nbsp;case&nbsp;sensitive,&nbsp;the&nbsp;string</span></span></span></div><div class="line"><a name="line411"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&quot;cheddar&quot;&nbsp;is&nbsp;not&nbsp;found&nbsp;in&nbsp;`myCapString`,&nbsp;so&nbsp;the&nbsp;second&nbsp;`writeln`&nbsp;method&nbsp;displays&nbsp;-1.</span></span></span></div><div class="line"><a name="line412"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line413"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myString=&quot;brie,&nbsp;pepper&nbsp;jack,&nbsp;cheddar&quot;</span></span></span></div><div class="line"><a name="line414"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCapString=&quot;Brie,&nbsp;Pepper&nbsp;Jack,&nbsp;Cheddar&quot;</span></span></span></div><div class="line"><a name="line415"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&#39;myString.indexOf(&quot;cheddar&quot;)&nbsp;is&nbsp;&#39;&nbsp;+&nbsp;myString.indexOf(&quot;cheddar&quot;))</span></span></span></div><div class="line"><a name="line416"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&#39;&lt;P&gt;myCapString.indexOf(&quot;cheddar&quot;)&nbsp;is&nbsp;&#39;&nbsp;+&nbsp;myCapString.indexOf(&quot;cheddar&quot;))</span></span></span></div><div class="line"><a name="line417"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line418"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;sets&nbsp;count&nbsp;to&nbsp;the&nbsp;number&nbsp;of&nbsp;occurrences&nbsp;of&nbsp;the&nbsp;letter&nbsp;x&nbsp;in&nbsp;the&nbsp;string&nbsp;str:</span></span></span></div><div class="line"><a name="line419"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line420"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;0;</span></span></span></div><div class="line"><a name="line421"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pos&nbsp;=&nbsp;str.indexOf(&quot;x&quot;);</span></span></span></div><div class="line"><a name="line422"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(&nbsp;pos&nbsp;!=&nbsp;-1&nbsp;)&nbsp;{</span></span></span></div><div class="line"><a name="line423"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count++;</span></span></span></div><div class="line"><a name="line424"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pos&nbsp;=&nbsp;str.indexOf(&quot;x&quot;,pos+1);</span></span></span></div><div class="line"><a name="line425"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line426"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line427"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>searchValue</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>A&nbsp;string&nbsp;representing&nbsp;the&nbsp;value&nbsp;to&nbsp;search&nbsp;for.</span></span></span></span></span></div><div class="line"><a name="line428"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>fromIndex</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;location&nbsp;within&nbsp;the&nbsp;calling&nbsp;string&nbsp;to&nbsp;start&nbsp;the&nbsp;search&nbsp;from.&nbsp;It&nbsp;can&nbsp;be&nbsp;any&nbsp;integer&nbsp;between&nbsp;0&nbsp;and</span></span></span></span></span></div><div class="line"><a name="line429"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.&nbsp;The&nbsp;default&nbsp;value&nbsp;is&nbsp;0.</span></span></span></div><div class="line"><a name="line430"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Position</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>of&nbsp;specified&nbsp;value&nbsp;or&nbsp;-1&nbsp;if&nbsp;not&nbsp;found.</span></span></span></span></span></div><div class="line"><a name="line431"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line432"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line433"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line434"><a name="String-method-lastIndexOf"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;lastIndexOf</span></span></span></div><div class="line"><a name="line435"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;index&nbsp;within&nbsp;the&nbsp;calling&nbsp;String&nbsp;object&nbsp;of&nbsp;the&nbsp;last&nbsp;occurrence&nbsp;of</span></span></span></div><div class="line"><a name="line436"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;specified&nbsp;value,&nbsp;or&nbsp;-1&nbsp;if&nbsp;not&nbsp;found.&nbsp;The&nbsp;calling&nbsp;string&nbsp;is&nbsp;searched</span></span></span></div><div class="line"><a name="line437"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;backward,&nbsp;starting&nbsp;at&nbsp;fromIndex.</span></span></span></div><div class="line"><a name="line438"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line439"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Characters&nbsp;in&nbsp;a&nbsp;string&nbsp;are&nbsp;indexed&nbsp;from&nbsp;left&nbsp;to&nbsp;right.&nbsp;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;character&nbsp;is&nbsp;0,&nbsp;and&nbsp;the&nbsp;index&nbsp;of&nbsp;the&nbsp;last&nbsp;character</span></span></span></div><div class="line"><a name="line440"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;`stringName.length&nbsp;-&nbsp;1`.</span></span></span></div><div class="line"><a name="line441"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line442"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;canal&quot;.lastIndexOf(&quot;a&quot;)&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;3</span></span></span></div><div class="line"><a name="line443"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;canal&quot;.lastIndexOf(&quot;a&quot;,2)&nbsp;//&nbsp;returns&nbsp;1</span></span></span></div><div class="line"><a name="line444"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;canal&quot;.lastIndexOf(&quot;a&quot;,0)&nbsp;//&nbsp;returns&nbsp;-1</span></span></span></div><div class="line"><a name="line445"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;canal&quot;.lastIndexOf(&quot;x&quot;)&nbsp;&nbsp;&nbsp;//&nbsp;returns&nbsp;-1</span></span></span></div><div class="line"><a name="line446"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line447"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`lastIndexOf`&nbsp;method&nbsp;is&nbsp;case&nbsp;sensitive.&nbsp;For&nbsp;example,&nbsp;the&nbsp;following&nbsp;expression&nbsp;returns&nbsp;-1:</span></span></span></div><div class="line"><a name="line448"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line449"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Blue&nbsp;Whale,&nbsp;Killer&nbsp;Whale&quot;.lastIndexOf(&quot;blue&quot;)</span></span></span></div><div class="line"><a name="line450"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line451"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;uses&nbsp;`indexOf`&nbsp;and&nbsp;`lastIndexOf`&nbsp;to&nbsp;locate&nbsp;values&nbsp;in&nbsp;the&nbsp;string&nbsp;&quot;`Brave&nbsp;new&nbsp;world`&quot;.</span></span></span></div><div class="line"><a name="line452"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line453"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;anyString=&quot;Brave&nbsp;new&nbsp;world&quot;</span></span></span></div><div class="line"><a name="line454"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line455"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;8</span></span></span></div><div class="line"><a name="line456"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;w&nbsp;from&nbsp;the&nbsp;beginning&nbsp;is&nbsp;&quot;&nbsp;+</span></span></span></div><div class="line"><a name="line457"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;anyString.indexOf(&quot;w&quot;))</span></span></span></div><div class="line"><a name="line458"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;10</span></span></span></div><div class="line"><a name="line459"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;w&nbsp;from&nbsp;the&nbsp;end&nbsp;is&nbsp;&quot;&nbsp;+</span></span></span></div><div class="line"><a name="line460"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;anyString.lastIndexOf(&quot;w&quot;))</span></span></span></div><div class="line"><a name="line461"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;6</span></span></span></div><div class="line"><a name="line462"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;&#39;new&#39;&nbsp;from&nbsp;the&nbsp;beginning&nbsp;is&nbsp;&quot;&nbsp;+</span></span></span></div><div class="line"><a name="line463"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;anyString.indexOf(&quot;new&quot;))</span></span></span></div><div class="line"><a name="line464"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;6</span></span></span></div><div class="line"><a name="line465"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;P&gt;The&nbsp;index&nbsp;of&nbsp;&#39;new&#39;&nbsp;from&nbsp;the&nbsp;end&nbsp;is&nbsp;&quot;&nbsp;+</span></span></span></div><div class="line"><a name="line466"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;anyString.lastIndexOf(&quot;new&quot;))</span></span></span></div><div class="line"><a name="line467"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line468"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>searchValue</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>A&nbsp;string&nbsp;representing&nbsp;the&nbsp;value&nbsp;to&nbsp;search&nbsp;for.</span></span></span></span></span></div><div class="line"><a name="line469"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>fromIndex</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;location&nbsp;within&nbsp;the&nbsp;calling&nbsp;string&nbsp;to&nbsp;start&nbsp;the&nbsp;search&nbsp;from,&nbsp;indexed&nbsp;from&nbsp;left&nbsp;to&nbsp;right.&nbsp;It&nbsp;can</span></span></span></span></span></div><div class="line"><a name="line470"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;be&nbsp;any&nbsp;integer&nbsp;between&nbsp;0&nbsp;and&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.&nbsp;The&nbsp;default&nbsp;value&nbsp;is&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line471"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;{Number}</span></span></span></div><div class="line"><a name="line472"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line473"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line474"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line475"><a name="String-method-localeCompare"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;localeCompare</span></span></span></div><div class="line"><a name="line476"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;a&nbsp;number&nbsp;indicating&nbsp;whether&nbsp;a&nbsp;reference&nbsp;string&nbsp;comes&nbsp;before&nbsp;or&nbsp;after&nbsp;or&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the</span></span></span></div><div class="line"><a name="line477"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;given&nbsp;string&nbsp;in&nbsp;sort&nbsp;order.</span></span></span></div><div class="line"><a name="line478"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line479"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;a&nbsp;number&nbsp;indicating&nbsp;whether&nbsp;a&nbsp;reference&nbsp;string&nbsp;comes&nbsp;before&nbsp;or&nbsp;after&nbsp;or&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the</span></span></span></div><div class="line"><a name="line480"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;given&nbsp;string&nbsp;in&nbsp;sort&nbsp;order.&nbsp;Returns&nbsp;-1&nbsp;if&nbsp;the&nbsp;string&nbsp;occurs&nbsp;earlier&nbsp;in&nbsp;a&nbsp;sort&nbsp;than&nbsp;`compareString`,</span></span></span></div><div class="line"><a name="line481"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;returns&nbsp;1&nbsp;if&nbsp;the&nbsp;string&nbsp;occurs&nbsp;afterwards&nbsp;in&nbsp;such&nbsp;a&nbsp;sort,&nbsp;and&nbsp;returns&nbsp;0&nbsp;if&nbsp;they&nbsp;occur&nbsp;at&nbsp;the&nbsp;same</span></span></span></div><div class="line"><a name="line482"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;level.</span></span></span></div><div class="line"><a name="line483"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line484"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;demonstrates&nbsp;the&nbsp;different&nbsp;potential&nbsp;results&nbsp;for&nbsp;a&nbsp;string&nbsp;occurring&nbsp;before,</span></span></span></div><div class="line"><a name="line485"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;after,&nbsp;or&nbsp;at&nbsp;the&nbsp;same&nbsp;level&nbsp;as&nbsp;another:</span></span></span></div><div class="line"><a name="line486"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line487"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&#39;a&#39;.localeCompare(&#39;b&#39;));&nbsp;//&nbsp;-1</span></span></span></div><div class="line"><a name="line488"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&#39;b&#39;.localeCompare(&#39;a&#39;));&nbsp;//&nbsp;1</span></span></span></div><div class="line"><a name="line489"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&#39;b&#39;.localeCompare(&#39;b&#39;));&nbsp;//&nbsp;0</span></span></span></div><div class="line"><a name="line490"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line491"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>compareString</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;string&nbsp;against&nbsp;which&nbsp;the&nbsp;referring&nbsp;string&nbsp;is&nbsp;comparing.</span></span></span></span></span></div><div class="line"><a name="line492"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Returns</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>-1&nbsp;if&nbsp;the&nbsp;string&nbsp;occurs&nbsp;earlier&nbsp;in&nbsp;a&nbsp;sort&nbsp;than</span></span></span></span></span></div><div class="line"><a name="line493"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;compareString,&nbsp;returns&nbsp;1&nbsp;if&nbsp;the&nbsp;string&nbsp;occurs&nbsp;afterwards&nbsp;in&nbsp;such&nbsp;a&nbsp;sort,&nbsp;and</span></span></span></div><div class="line"><a name="line494"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;returns&nbsp;0&nbsp;if&nbsp;they&nbsp;occur&nbsp;at&nbsp;the&nbsp;same&nbsp;level.</span></span></span></div><div class="line"><a name="line495"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line496"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line497"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line498"><a name="String-method-match"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;match</span></span></span></div><div class="line"><a name="line499"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Used&nbsp;to&nbsp;match&nbsp;a&nbsp;regular&nbsp;expression&nbsp;against&nbsp;a&nbsp;string.</span></span></span></div><div class="line"><a name="line500"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line501"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;the&nbsp;regular&nbsp;expression&nbsp;does&nbsp;not&nbsp;include&nbsp;the&nbsp;`g`&nbsp;flag,&nbsp;returns&nbsp;the&nbsp;same&nbsp;result&nbsp;as&nbsp;`regexp.exec(string)`.</span></span></span></div><div class="line"><a name="line502"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line503"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;the&nbsp;regular&nbsp;expression&nbsp;includes&nbsp;the&nbsp;`g`&nbsp;flag,&nbsp;the&nbsp;method&nbsp;returns&nbsp;an&nbsp;Array&nbsp;containing&nbsp;all&nbsp;matches.&nbsp;If&nbsp;there&nbsp;were&nbsp;no&nbsp;matches,</span></span></span></div><div class="line"><a name="line504"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;method&nbsp;returns&nbsp;`null`.</span></span></span></div><div class="line"><a name="line505"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line506"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;returned&nbsp;{@link&nbsp;Array}&nbsp;has&nbsp;an&nbsp;extra&nbsp;`input`&nbsp;property,&nbsp;which&nbsp;contains&nbsp;the&nbsp;regexp&nbsp;that&nbsp;generated&nbsp;it&nbsp;as&nbsp;a&nbsp;result.&nbsp;In&nbsp;addition,</span></span></span></div><div class="line"><a name="line507"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;it&nbsp;has&nbsp;an&nbsp;`index`&nbsp;property,&nbsp;which&nbsp;represents&nbsp;the&nbsp;zero-based&nbsp;index&nbsp;of&nbsp;the&nbsp;match&nbsp;in&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line508"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line509"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;the&nbsp;following&nbsp;example,&nbsp;`match`&nbsp;is&nbsp;used&nbsp;to&nbsp;find&nbsp;&quot;Chapter&quot;&nbsp;followed&nbsp;by&nbsp;1&nbsp;or&nbsp;more&nbsp;numeric&nbsp;characters&nbsp;followed&nbsp;by&nbsp;a&nbsp;decimal&nbsp;point</span></span></span></div><div class="line"><a name="line510"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;and&nbsp;numeric&nbsp;character&nbsp;0&nbsp;or&nbsp;more&nbsp;times.&nbsp;The&nbsp;regular&nbsp;expression&nbsp;includes&nbsp;the&nbsp;`i`&nbsp;flag&nbsp;so&nbsp;that&nbsp;case&nbsp;will&nbsp;be&nbsp;ignored.</span></span></span></div><div class="line"><a name="line511"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line512"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;=&nbsp;&quot;For&nbsp;more&nbsp;information,&nbsp;see&nbsp;Chapter&nbsp;3.4.5.1&quot;;</span></span></span></div><div class="line"><a name="line513"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;re&nbsp;=&nbsp;/(chapter&nbsp;\d+(\.\d)*)/i;</span></span></span></div><div class="line"><a name="line514"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;found&nbsp;=&nbsp;str.match(re);</span></span></span></div><div class="line"><a name="line515"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(found);</span></span></span></div><div class="line"><a name="line516"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line517"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;returns&nbsp;the&nbsp;array&nbsp;containing&nbsp;Chapter&nbsp;3.4.5.1,Chapter&nbsp;3.4.5.1,.1</span></span></span></div><div class="line"><a name="line518"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line519"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&quot;`Chapter&nbsp;3.4.5.1`&quot;&nbsp;is&nbsp;the&nbsp;first&nbsp;match&nbsp;and&nbsp;the&nbsp;first&nbsp;value&nbsp;remembered&nbsp;from&nbsp;`(Chapter&nbsp;\d+(\.\d)*)`.</span></span></span></div><div class="line"><a name="line520"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line521"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&quot;`.1`&quot;&nbsp;is&nbsp;the&nbsp;second&nbsp;value&nbsp;remembered&nbsp;from&nbsp;`(\.\d)`.</span></span></span></div><div class="line"><a name="line522"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line523"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;demonstrates&nbsp;the&nbsp;use&nbsp;of&nbsp;the&nbsp;global&nbsp;and&nbsp;ignore&nbsp;case&nbsp;flags&nbsp;with&nbsp;`match`.&nbsp;All&nbsp;letters&nbsp;A&nbsp;through&nbsp;E&nbsp;and&nbsp;a</span></span></span></div><div class="line"><a name="line524"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;through&nbsp;e&nbsp;are&nbsp;returned,&nbsp;each&nbsp;its&nbsp;own&nbsp;element&nbsp;in&nbsp;the&nbsp;array</span></span></span></div><div class="line"><a name="line525"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line526"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str&nbsp;=&nbsp;&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&quot;;</span></span></span></div><div class="line"><a name="line527"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;regexp&nbsp;=&nbsp;/[A-E]/gi;</span></span></span></div><div class="line"><a name="line528"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;matches_array&nbsp;=&nbsp;str.match(regexp);</span></span></span></div><div class="line"><a name="line529"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(matches_array);</span></span></span></div><div class="line"><a name="line530"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line531"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`matches_array`&nbsp;now&nbsp;equals&nbsp;`[&#39;A&#39;,&nbsp;&#39;B&#39;,&nbsp;&#39;C&#39;,&nbsp;&#39;D&#39;,&nbsp;&#39;E&#39;,&nbsp;&#39;a&#39;,&nbsp;&#39;b&#39;,&nbsp;&#39;c&#39;,&nbsp;&#39;d&#39;,&nbsp;&#39;e&#39;]`.</span></span></span></div><div class="line"><a name="line532"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line533"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{RegExp}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>regexp</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>A&nbsp;{@link&nbsp;RegExp}&nbsp;object.&nbsp;If&nbsp;a&nbsp;non-RegExp&nbsp;object&nbsp;`obj`&nbsp;is&nbsp;passed,&nbsp;it&nbsp;is</span></span></span></span></span></div><div class="line"><a name="line534"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;implicitly&nbsp;converted&nbsp;to&nbsp;a&nbsp;RegExp&nbsp;by&nbsp;using&nbsp;`new&nbsp;RegExp(obj)`.</span></span></span></div><div class="line"><a name="line535"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Contains</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>results&nbsp;of&nbsp;the&nbsp;match&nbsp;(if&nbsp;any).</span></span></span></span></span></div><div class="line"><a name="line536"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line537"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line538"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line539"><a name="String-method-replace"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;replace</span></span></span></div><div class="line"><a name="line540"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Used&nbsp;to&nbsp;find&nbsp;a&nbsp;match&nbsp;between&nbsp;a&nbsp;regular&nbsp;expression&nbsp;and&nbsp;a&nbsp;string,&nbsp;and&nbsp;to&nbsp;replace&nbsp;the&nbsp;matched&nbsp;substring</span></span></span></div><div class="line"><a name="line541"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;with&nbsp;a&nbsp;new&nbsp;substring.</span></span></span></div><div class="line"><a name="line542"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line543"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;method&nbsp;does&nbsp;not&nbsp;change&nbsp;the&nbsp;`String`&nbsp;object&nbsp;it&nbsp;is&nbsp;called&nbsp;on.&nbsp;It&nbsp;simply&nbsp;returns&nbsp;a&nbsp;new&nbsp;string.</span></span></span></div><div class="line"><a name="line544"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line545"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;To&nbsp;perform&nbsp;a&nbsp;global&nbsp;search&nbsp;and&nbsp;replace,&nbsp;either&nbsp;include&nbsp;the&nbsp;`g`&nbsp;flag&nbsp;in&nbsp;the&nbsp;regular&nbsp;expression&nbsp;or&nbsp;if</span></span></span></div><div class="line"><a name="line546"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;first&nbsp;parameter&nbsp;is&nbsp;a&nbsp;string,&nbsp;include&nbsp;`g`&nbsp;in&nbsp;the&nbsp;flags&nbsp;parameter.</span></span></span></div><div class="line"><a name="line547"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line548"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;replacement&nbsp;string&nbsp;can&nbsp;include&nbsp;the&nbsp;following&nbsp;special&nbsp;replacement&nbsp;patterns:</span></span></span></div><div class="line"><a name="line549"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line550"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;Pattern&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Inserts</span></span></span></div><div class="line"><a name="line551"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|:--------------|:--------------------------------------------------------------------------------------</span></span></span></div><div class="line"><a name="line552"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`$$`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Inserts&nbsp;a&nbsp;`$`.</span></span></span></div><div class="line"><a name="line553"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`$&amp;`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Inserts&nbsp;the&nbsp;matched&nbsp;substring.</span></span></span></div><div class="line"><a name="line554"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`$``&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Inserts&nbsp;the&nbsp;portion&nbsp;of&nbsp;the&nbsp;string&nbsp;that&nbsp;precedes&nbsp;the&nbsp;matched&nbsp;substring.</span></span></span></div><div class="line"><a name="line555"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`$&#39;`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Inserts&nbsp;the&nbsp;portion&nbsp;of&nbsp;the&nbsp;string&nbsp;that&nbsp;follows&nbsp;the&nbsp;matched&nbsp;substring.</span></span></span></div><div class="line"><a name="line556"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`$n`&nbsp;or&nbsp;`$nn`&nbsp;|&nbsp;Where&nbsp;`n`&nbsp;or&nbsp;`nn`&nbsp;are&nbsp;decimal&nbsp;digits,&nbsp;inserts&nbsp;the&nbsp;_n_th&nbsp;parenthesized&nbsp;submatch&nbsp;string,&nbsp;provided&nbsp;the&nbsp;first</span></span></span></div><div class="line"><a name="line557"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;argument&nbsp;was&nbsp;a&nbsp;`RegExp`&nbsp;object.</span></span></span></div><div class="line"><a name="line558"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line559"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;You&nbsp;can&nbsp;specify&nbsp;a&nbsp;function&nbsp;as&nbsp;the&nbsp;second&nbsp;parameter.&nbsp;In&nbsp;this&nbsp;case,&nbsp;the&nbsp;function&nbsp;will&nbsp;be&nbsp;invoked&nbsp;after&nbsp;the&nbsp;match&nbsp;has&nbsp;been</span></span></span></div><div class="line"><a name="line560"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;performed.&nbsp;The&nbsp;function&#39;s&nbsp;result&nbsp;(return&nbsp;value)&nbsp;will&nbsp;be&nbsp;used&nbsp;as&nbsp;the&nbsp;replacement&nbsp;string.&nbsp;(Note:&nbsp;the&nbsp;above-mentioned&nbsp;special</span></span></span></div><div class="line"><a name="line561"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;replacement&nbsp;patterns&nbsp;do&nbsp;not&nbsp;apply&nbsp;in&nbsp;this&nbsp;case.)&nbsp;Note&nbsp;that&nbsp;the&nbsp;function&nbsp;will&nbsp;be&nbsp;invoked&nbsp;multiple&nbsp;times&nbsp;for&nbsp;each&nbsp;full&nbsp;match&nbsp;to&nbsp;be</span></span></span></div><div class="line"><a name="line562"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;replaced&nbsp;if&nbsp;the&nbsp;regular&nbsp;expression&nbsp;in&nbsp;the&nbsp;first&nbsp;parameter&nbsp;is&nbsp;global.</span></span></span></div><div class="line"><a name="line563"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line564"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;arguments&nbsp;to&nbsp;the&nbsp;function&nbsp;are&nbsp;as&nbsp;follows:</span></span></span></div><div class="line"><a name="line565"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line566"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;Possible&nbsp;Name&nbsp;|&nbsp;Supplied&nbsp;Value</span></span></span></div><div class="line"><a name="line567"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|:--------------|:--------------------------------------------------------------------------------------</span></span></span></div><div class="line"><a name="line568"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`str`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;The&nbsp;matched&nbsp;substring.&nbsp;(Corresponds&nbsp;to&nbsp;`$&amp;`&nbsp;above.)</span></span></span></div><div class="line"><a name="line569"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`p1,&nbsp;p2,&nbsp;...`&nbsp;|&nbsp;The&nbsp;_n_th&nbsp;parenthesized&nbsp;submatch&nbsp;string,&nbsp;provided&nbsp;the&nbsp;first&nbsp;argument&nbsp;to&nbsp;replace&nbsp;was&nbsp;a&nbsp;`RegExp`&nbsp;object.</span></span></span></div><div class="line"><a name="line570"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;(Correspond&nbsp;to&nbsp;$1,&nbsp;$2,&nbsp;etc.&nbsp;above.)</span></span></span></div><div class="line"><a name="line571"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`offset`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;The&nbsp;offset&nbsp;of&nbsp;the&nbsp;matched&nbsp;substring&nbsp;within&nbsp;the&nbsp;total&nbsp;string&nbsp;being&nbsp;examined.&nbsp;(For&nbsp;example,&nbsp;if&nbsp;the&nbsp;total&nbsp;string</span></span></span></div><div class="line"><a name="line572"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;was&nbsp;&quot;`abcd`&quot;,&nbsp;and&nbsp;the&nbsp;matched&nbsp;substring&nbsp;was&nbsp;&quot;`bc`&quot;,&nbsp;then&nbsp;this&nbsp;argument&nbsp;will&nbsp;be&nbsp;1.)</span></span></span></div><div class="line"><a name="line573"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;|&nbsp;`s`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;The&nbsp;total&nbsp;string&nbsp;being&nbsp;examined.</span></span></span></div><div class="line"><a name="line574"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line575"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;(The&nbsp;exact&nbsp;number&nbsp;of&nbsp;arguments&nbsp;will&nbsp;depend&nbsp;on&nbsp;whether&nbsp;the&nbsp;first&nbsp;argument&nbsp;was&nbsp;a&nbsp;`RegExp`&nbsp;object&nbsp;and,&nbsp;if&nbsp;so,&nbsp;how&nbsp;many&nbsp;parenthesized</span></span></span></div><div class="line"><a name="line576"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;submatches&nbsp;it&nbsp;specifies.)</span></span></span></div><div class="line"><a name="line577"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line578"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;will&nbsp;set&nbsp;`newString`&nbsp;to&nbsp;&quot;`XXzzzz&nbsp;-&nbsp;XX&nbsp;,&nbsp;zzzz`&quot;:</span></span></span></div><div class="line"><a name="line579"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line580"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;replacer(str,&nbsp;p1,&nbsp;p2,&nbsp;offset,&nbsp;s)</span></span></span></div><div class="line"><a name="line581"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line582"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;str&nbsp;+&nbsp;&quot;&nbsp;-&nbsp;&quot;&nbsp;+&nbsp;p1&nbsp;+&nbsp;&quot;&nbsp;,&nbsp;&quot;&nbsp;+&nbsp;p2;</span></span></span></div><div class="line"><a name="line583"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line584"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newString&nbsp;=&nbsp;&quot;XXzzzz&quot;.replace(/(X*)(z*)/,&nbsp;replacer);</span></span></span></div><div class="line"><a name="line585"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line586"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;the&nbsp;following&nbsp;example,&nbsp;the&nbsp;regular&nbsp;expression&nbsp;includes&nbsp;the&nbsp;global&nbsp;and&nbsp;ignore&nbsp;case&nbsp;flags&nbsp;which&nbsp;permits&nbsp;replace&nbsp;to&nbsp;replace&nbsp;each</span></span></span></div><div class="line"><a name="line587"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;occurrence&nbsp;of&nbsp;&#39;apples&#39;&nbsp;in&nbsp;the&nbsp;string&nbsp;with&nbsp;&#39;oranges&#39;.</span></span></span></div><div class="line"><a name="line588"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line589"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;re&nbsp;=&nbsp;/apples/gi;</span></span></span></div><div class="line"><a name="line590"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str&nbsp;=&nbsp;&quot;Apples&nbsp;are&nbsp;round,&nbsp;and&nbsp;apples&nbsp;are&nbsp;juicy.&quot;;</span></span></span></div><div class="line"><a name="line591"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newstr&nbsp;=&nbsp;str.replace(re,&nbsp;&quot;oranges&quot;);</span></span></span></div><div class="line"><a name="line592"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(newstr);</span></span></span></div><div class="line"><a name="line593"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line594"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;this&nbsp;version,&nbsp;a&nbsp;string&nbsp;is&nbsp;used&nbsp;as&nbsp;the&nbsp;first&nbsp;parameter&nbsp;and&nbsp;the&nbsp;global&nbsp;and&nbsp;ignore&nbsp;case&nbsp;flags&nbsp;are&nbsp;specified&nbsp;in&nbsp;the&nbsp;flags</span></span></span></div><div class="line"><a name="line595"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;parameter.</span></span></span></div><div class="line"><a name="line596"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line597"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str&nbsp;=&nbsp;&quot;Apples&nbsp;are&nbsp;round,&nbsp;and&nbsp;apples&nbsp;are&nbsp;juicy.&quot;;</span></span></span></div><div class="line"><a name="line598"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newstr&nbsp;=&nbsp;str.replace(&quot;apples&quot;,&nbsp;&quot;oranges&quot;,&nbsp;&quot;gi&quot;);</span></span></span></div><div class="line"><a name="line599"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(newstr);</span></span></span></div><div class="line"><a name="line600"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line601"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Both&nbsp;of&nbsp;these&nbsp;examples&nbsp;print&nbsp;&quot;oranges&nbsp;are&nbsp;round,&nbsp;and&nbsp;oranges&nbsp;are&nbsp;juicy.&quot;</span></span></span></div><div class="line"><a name="line602"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line603"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;the&nbsp;following&nbsp;example,&nbsp;the&nbsp;regular&nbsp;expression&nbsp;is&nbsp;defined&nbsp;in&nbsp;replace&nbsp;and&nbsp;includes&nbsp;the&nbsp;ignore&nbsp;case&nbsp;flag.</span></span></span></div><div class="line"><a name="line604"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line605"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str&nbsp;=&nbsp;&quot;Twas&nbsp;the&nbsp;night&nbsp;before&nbsp;Xmas...&quot;;</span></span></span></div><div class="line"><a name="line606"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newstr&nbsp;=&nbsp;str.replace(/xmas/i,&nbsp;&quot;Christmas&quot;);</span></span></span></div><div class="line"><a name="line607"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(newstr);</span></span></span></div><div class="line"><a name="line608"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line609"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;prints&nbsp;&quot;Twas&nbsp;the&nbsp;night&nbsp;before&nbsp;Christmas...&quot;</span></span></span></div><div class="line"><a name="line610"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line611"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;script&nbsp;switches&nbsp;the&nbsp;words&nbsp;in&nbsp;the&nbsp;string.&nbsp;For&nbsp;the&nbsp;replacement&nbsp;text,&nbsp;the&nbsp;script&nbsp;uses&nbsp;the&nbsp;$1&nbsp;and&nbsp;$2&nbsp;replacement</span></span></span></div><div class="line"><a name="line612"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;patterns.</span></span></span></div><div class="line"><a name="line613"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line614"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;re&nbsp;=&nbsp;/(\w+)\s(\w+)/;</span></span></span></div><div class="line"><a name="line615"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str&nbsp;=&nbsp;&quot;John&nbsp;Smith&quot;;</span></span></span></div><div class="line"><a name="line616"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newstr&nbsp;=&nbsp;str.replace(re,&nbsp;&quot;$2,&nbsp;$1&quot;);</span></span></span></div><div class="line"><a name="line617"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(newstr);</span></span></span></div><div class="line"><a name="line618"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line619"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;prints&nbsp;&quot;Smith,&nbsp;John&quot;.</span></span></span></div><div class="line"><a name="line620"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line621"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;this&nbsp;example,&nbsp;all&nbsp;occurrences&nbsp;of&nbsp;capital&nbsp;letters&nbsp;in&nbsp;the&nbsp;string&nbsp;are&nbsp;converted&nbsp;to&nbsp;lower&nbsp;case,&nbsp;and&nbsp;a&nbsp;hyphen&nbsp;is&nbsp;inserted&nbsp;just</span></span></span></div><div class="line"><a name="line622"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;before&nbsp;the&nbsp;match&nbsp;location.&nbsp;The&nbsp;important&nbsp;thing&nbsp;here&nbsp;is&nbsp;that&nbsp;additional&nbsp;operations&nbsp;are&nbsp;needed&nbsp;on&nbsp;the&nbsp;matched&nbsp;item&nbsp;before&nbsp;it&nbsp;is</span></span></span></div><div class="line"><a name="line623"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;given&nbsp;back&nbsp;as&nbsp;a&nbsp;replacement.</span></span></span></div><div class="line"><a name="line624"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line625"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;replacement&nbsp;function&nbsp;accepts&nbsp;the&nbsp;matched&nbsp;snippet&nbsp;as&nbsp;its&nbsp;parameter,&nbsp;and&nbsp;uses&nbsp;it&nbsp;to&nbsp;transform&nbsp;the&nbsp;case&nbsp;and&nbsp;concatenate&nbsp;the</span></span></span></div><div class="line"><a name="line626"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;hyphen&nbsp;before&nbsp;returning.</span></span></span></div><div class="line"><a name="line627"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line628"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;styleHyphenFormat(propertyName)</span></span></span></div><div class="line"><a name="line629"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line630"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;upperToHyphenLower(match)</span></span></span></div><div class="line"><a name="line631"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line632"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&#39;-&#39;&nbsp;+&nbsp;match.toLowerCase();</span></span></span></div><div class="line"><a name="line633"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line634"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;propertyName.replace(/[A-Z]/,&nbsp;upperToHyphenLower);</span></span></span></div><div class="line"><a name="line635"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line636"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line637"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Given&nbsp;`styleHyphenFormat(&#39;borderTop&#39;)`,&nbsp;this&nbsp;returns&nbsp;&#39;border-top&#39;.</span></span></span></div><div class="line"><a name="line638"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line639"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Because&nbsp;we&nbsp;want&nbsp;to&nbsp;further&nbsp;transform&nbsp;the&nbsp;_result_&nbsp;of&nbsp;the&nbsp;match&nbsp;before&nbsp;the&nbsp;final&nbsp;substitution&nbsp;is&nbsp;made,&nbsp;we&nbsp;must&nbsp;use&nbsp;a&nbsp;function.</span></span></span></div><div class="line"><a name="line640"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;forces&nbsp;the&nbsp;evaluation&nbsp;of&nbsp;the&nbsp;match&nbsp;prior&nbsp;to&nbsp;the&nbsp;`toLowerCase()`&nbsp;method.&nbsp;If&nbsp;we&nbsp;had&nbsp;tried&nbsp;to&nbsp;do&nbsp;this&nbsp;using&nbsp;the&nbsp;match&nbsp;without&nbsp;a</span></span></span></div><div class="line"><a name="line641"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;function,&nbsp;the&nbsp;`toLowerCase()`&nbsp;would&nbsp;have&nbsp;no&nbsp;effect.</span></span></span></div><div class="line"><a name="line642"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line643"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;newString&nbsp;=&nbsp;propertyName.replace(/[A-Z]/,&nbsp;&#39;-&#39;&nbsp;+&nbsp;&#39;$&amp;&#39;.toLowerCase());&nbsp;&nbsp;//&nbsp;won&#39;t&nbsp;work</span></span></span></div><div class="line"><a name="line644"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line645"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;is&nbsp;because&nbsp;`&#39;$&amp;&#39;.toLowerCase()`&nbsp;would&nbsp;be&nbsp;evaluated&nbsp;first&nbsp;as&nbsp;a&nbsp;string&nbsp;literal&nbsp;(resulting&nbsp;in&nbsp;the&nbsp;same&nbsp;`&#39;$&amp;&#39;`)&nbsp;before&nbsp;using&nbsp;the</span></span></span></div><div class="line"><a name="line646"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;characters&nbsp;as&nbsp;a&nbsp;pattern.</span></span></span></div><div class="line"><a name="line647"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line648"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;replaces&nbsp;a&nbsp;Fahrenheit&nbsp;degree&nbsp;with&nbsp;its&nbsp;equivalent&nbsp;Celsius&nbsp;degree.&nbsp;The&nbsp;Fahrenheit&nbsp;degree&nbsp;should&nbsp;be&nbsp;a&nbsp;number</span></span></span></div><div class="line"><a name="line649"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;ending&nbsp;with&nbsp;F.&nbsp;The&nbsp;function&nbsp;returns&nbsp;the&nbsp;Celsius&nbsp;number&nbsp;ending&nbsp;with&nbsp;C.&nbsp;For&nbsp;example,&nbsp;if&nbsp;the&nbsp;input&nbsp;number&nbsp;is&nbsp;212F,&nbsp;the&nbsp;function</span></span></span></div><div class="line"><a name="line650"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;returns&nbsp;100C.&nbsp;If&nbsp;the&nbsp;number&nbsp;is&nbsp;0F,&nbsp;the&nbsp;function&nbsp;returns&nbsp;-17.77777777777778C.</span></span></span></div><div class="line"><a name="line651"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line652"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;regular&nbsp;expression&nbsp;`test`&nbsp;checks&nbsp;for&nbsp;any&nbsp;number&nbsp;that&nbsp;ends&nbsp;with&nbsp;F.&nbsp;The&nbsp;number&nbsp;of&nbsp;Fahrenheit&nbsp;degree&nbsp;is&nbsp;accessible&nbsp;to&nbsp;the</span></span></span></div><div class="line"><a name="line653"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;function&nbsp;through&nbsp;its&nbsp;second&nbsp;parameter,&nbsp;`p1`.&nbsp;The&nbsp;function&nbsp;sets&nbsp;the&nbsp;Celsius&nbsp;number&nbsp;based&nbsp;on&nbsp;the&nbsp;Fahrenheit&nbsp;degree&nbsp;passed&nbsp;in&nbsp;a</span></span></span></div><div class="line"><a name="line654"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;string&nbsp;to&nbsp;the&nbsp;`f2c`&nbsp;function.&nbsp;`f2c`&nbsp;then&nbsp;returns&nbsp;the&nbsp;Celsius&nbsp;number.&nbsp;This&nbsp;function&nbsp;approximates&nbsp;Perl&#39;s&nbsp;`s///e`&nbsp;flag.</span></span></span></div><div class="line"><a name="line655"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line656"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;f2c(x)</span></span></span></div><div class="line"><a name="line657"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line658"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;convert(str,&nbsp;p1,&nbsp;offset,&nbsp;s)</span></span></span></div><div class="line"><a name="line659"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line660"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;((p1-32)&nbsp;*&nbsp;5/9)&nbsp;+&nbsp;&quot;C&quot;;</span></span></span></div><div class="line"><a name="line661"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line662"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;s&nbsp;=&nbsp;String(x);</span></span></span></div><div class="line"><a name="line663"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;test&nbsp;=&nbsp;/(\d+(?:\.\d*)?)F\b/g;</span></span></span></div><div class="line"><a name="line664"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;s.replace(test,&nbsp;convert);</span></span></span></div><div class="line"><a name="line665"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line666"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line667"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{String/RegExp}&nbsp;pattern&nbsp;Either&nbsp;a&nbsp;string&nbsp;or&nbsp;regular&nbsp;expression&nbsp;pattern&nbsp;to&nbsp;search&nbsp;for.</span></span></span></div><div class="line"><a name="line668"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line669"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;{String/Function}&nbsp;replacement&nbsp;Either&nbsp;string&nbsp;or&nbsp;function:</span></span></span></div><div class="line"><a name="line670"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line671"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;-&nbsp;The&nbsp;String&nbsp;to&nbsp;replace&nbsp;the&nbsp;`pattern`&nbsp;with.&nbsp;Number&nbsp;of&nbsp;special&nbsp;replacement&nbsp;patterns&nbsp;are&nbsp;supported;</span></span></span></div><div class="line"><a name="line672"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;see&nbsp;the&nbsp;&quot;Specifying&nbsp;a&nbsp;string&nbsp;as&nbsp;a&nbsp;parameter&quot;&nbsp;section&nbsp;above.</span></span></span></div><div class="line"><a name="line673"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;-&nbsp;A&nbsp;function&nbsp;to&nbsp;be&nbsp;invoked&nbsp;to&nbsp;create&nbsp;the&nbsp;replacement.</span></span></span></div><div class="line"><a name="line674"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;The&nbsp;arguments&nbsp;supplied&nbsp;to&nbsp;this&nbsp;function&nbsp;are&nbsp;described&nbsp;in&nbsp;the&nbsp;&quot;Specifying&nbsp;a&nbsp;function&nbsp;as&nbsp;a&nbsp;parameter&quot;</span></span></span></div><div class="line"><a name="line675"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;section&nbsp;above.</span></span></span></div><div class="line"><a name="line676"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line677"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>String</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>of&nbsp;matched&nbsp;replaced&nbsp;items.</span></span></span></span></span></div><div class="line"><a name="line678"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line679"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line680"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line681"><a name="String-method-search"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;search</span></span></span></div><div class="line"><a name="line682"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Executes&nbsp;the&nbsp;search&nbsp;for&nbsp;a&nbsp;match&nbsp;between&nbsp;a&nbsp;regular&nbsp;expression&nbsp;and&nbsp;a&nbsp;specified&nbsp;string.</span></span></span></div><div class="line"><a name="line683"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line684"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;successful,&nbsp;search&nbsp;returns&nbsp;the&nbsp;index&nbsp;of&nbsp;the&nbsp;regular&nbsp;expression&nbsp;inside&nbsp;the&nbsp;string.&nbsp;Otherwise,&nbsp;it</span></span></span></div><div class="line"><a name="line685"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;returns&nbsp;-1.</span></span></span></div><div class="line"><a name="line686"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line687"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;When&nbsp;you&nbsp;want&nbsp;to&nbsp;know&nbsp;whether&nbsp;a&nbsp;pattern&nbsp;is&nbsp;found&nbsp;in&nbsp;a&nbsp;string&nbsp;use&nbsp;search&nbsp;(similar&nbsp;to&nbsp;the&nbsp;regular</span></span></span></div><div class="line"><a name="line688"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;expression&nbsp;`test`&nbsp;method);&nbsp;for&nbsp;more&nbsp;information&nbsp;(but&nbsp;slower&nbsp;execution)&nbsp;use&nbsp;`match`&nbsp;(similar&nbsp;to&nbsp;the</span></span></span></div><div class="line"><a name="line689"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;regular&nbsp;expression&nbsp;`exec`&nbsp;method).</span></span></span></div><div class="line"><a name="line690"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line691"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;prints&nbsp;a&nbsp;message&nbsp;which&nbsp;depends&nbsp;on&nbsp;the&nbsp;success&nbsp;of&nbsp;the&nbsp;test.</span></span></span></div><div class="line"><a name="line692"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line693"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;testinput(re,&nbsp;str){</span></span></span></div><div class="line"><a name="line694"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(str.search(re)&nbsp;!=&nbsp;-1)</span></span></span></div><div class="line"><a name="line695"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;midstring&nbsp;=&nbsp;&quot;&nbsp;contains&nbsp;&quot;;</span></span></span></div><div class="line"><a name="line696"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else</span></span></span></div><div class="line"><a name="line697"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;midstring&nbsp;=&nbsp;&quot;&nbsp;does&nbsp;not&nbsp;contain&nbsp;&quot;;</span></span></span></div><div class="line"><a name="line698"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write&nbsp;(str&nbsp;+&nbsp;midstring&nbsp;+&nbsp;re);</span></span></span></div><div class="line"><a name="line699"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line700"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line701"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{RegExp}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>regexp</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>A&nbsp;regular&nbsp;expression&nbsp;object.&nbsp;If&nbsp;a&nbsp;non-RegExp&nbsp;object&nbsp;obj&nbsp;is&nbsp;passed,&nbsp;it&nbsp;is</span></span></span></span></span></div><div class="line"><a name="line702"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;implicitly&nbsp;converted&nbsp;to&nbsp;a&nbsp;RegExp&nbsp;by&nbsp;using&nbsp;`new&nbsp;RegExp(obj)`.</span></span></span></div><div class="line"><a name="line703"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>If</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>successful,&nbsp;search&nbsp;returns&nbsp;the&nbsp;index&nbsp;of&nbsp;the&nbsp;regular</span></span></span></span></span></div><div class="line"><a name="line704"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;expression&nbsp;inside&nbsp;the&nbsp;string.&nbsp;Otherwise,&nbsp;it&nbsp;returns&nbsp;-1.</span></span></span></div><div class="line"><a name="line705"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line706"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line707"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line708"><a name="String-method-slice"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;slice</span></span></span></div><div class="line"><a name="line709"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Extracts&nbsp;a&nbsp;section&nbsp;of&nbsp;a&nbsp;string&nbsp;and&nbsp;returns&nbsp;a&nbsp;new&nbsp;string.</span></span></span></div><div class="line"><a name="line710"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line711"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`slice`&nbsp;extracts&nbsp;the&nbsp;text&nbsp;from&nbsp;one&nbsp;string&nbsp;and&nbsp;returns&nbsp;a&nbsp;new&nbsp;string.&nbsp;Changes&nbsp;to&nbsp;the&nbsp;text&nbsp;in&nbsp;one</span></span></span></div><div class="line"><a name="line712"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;string&nbsp;do&nbsp;not&nbsp;affect&nbsp;the&nbsp;other&nbsp;string.</span></span></span></div><div class="line"><a name="line713"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line714"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`slice`&nbsp;extracts&nbsp;up&nbsp;to&nbsp;but&nbsp;not&nbsp;including&nbsp;`endSlice`.&nbsp;`string.slice(1,4)`&nbsp;extracts&nbsp;the&nbsp;second</span></span></span></div><div class="line"><a name="line715"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;character&nbsp;through&nbsp;the&nbsp;fourth&nbsp;character&nbsp;(characters&nbsp;indexed&nbsp;1,&nbsp;2,&nbsp;and&nbsp;3).</span></span></span></div><div class="line"><a name="line716"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line717"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;As&nbsp;a&nbsp;negative&nbsp;index,&nbsp;`endSlice`&nbsp;indicates&nbsp;an&nbsp;offset&nbsp;from&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;string.&nbsp;`string.slice(2,-1)`</span></span></span></div><div class="line"><a name="line718"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;extracts&nbsp;the&nbsp;third&nbsp;character&nbsp;through&nbsp;the&nbsp;second&nbsp;to&nbsp;last&nbsp;character&nbsp;in&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line719"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line720"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;uses&nbsp;slice&nbsp;to&nbsp;create&nbsp;a&nbsp;new&nbsp;string.</span></span></span></div><div class="line"><a name="line721"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line722"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;a&nbsp;print&nbsp;function&nbsp;is&nbsp;defined</span></span></span></div><div class="line"><a name="line723"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str1&nbsp;=&nbsp;&quot;The&nbsp;morning&nbsp;is&nbsp;upon&nbsp;us.&quot;;</span></span></span></div><div class="line"><a name="line724"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str2&nbsp;=&nbsp;str1.slice(4,&nbsp;-2);</span></span></span></div><div class="line"><a name="line725"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(str2);</span></span></span></div><div class="line"><a name="line726"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line727"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;writes:</span></span></span></div><div class="line"><a name="line728"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line729"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;morning&nbsp;is&nbsp;upon&nbsp;u</span></span></span></div><div class="line"><a name="line730"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line731"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>beginSlice</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;zero-based&nbsp;index&nbsp;at&nbsp;which&nbsp;to&nbsp;begin&nbsp;extraction.</span></span></span></span></span></div><div class="line"><a name="line732"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>endSlice</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;zero-based&nbsp;index&nbsp;at&nbsp;which&nbsp;to&nbsp;end&nbsp;extraction.&nbsp;If&nbsp;omitted,&nbsp;`slice`</span></span></span></span></span></div><div class="line"><a name="line733"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;extracts&nbsp;to&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line734"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>All</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>characters&nbsp;from&nbsp;specified&nbsp;start&nbsp;up&nbsp;to&nbsp;(but&nbsp;excluding)</span></span></span></span></span></div><div class="line"><a name="line735"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;end.</span></span></span></div><div class="line"><a name="line736"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line737"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line738"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line739"><a name="String-method-split"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;split</span></span></span></div><div class="line"><a name="line740"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Splits&nbsp;a&nbsp;`String`&nbsp;object&nbsp;into&nbsp;an&nbsp;array&nbsp;of&nbsp;strings&nbsp;by&nbsp;separating&nbsp;the&nbsp;string&nbsp;into&nbsp;substrings.</span></span></span></div><div class="line"><a name="line741"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line742"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`split`&nbsp;method&nbsp;returns&nbsp;the&nbsp;new&nbsp;array.</span></span></span></div><div class="line"><a name="line743"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line744"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;When&nbsp;found,&nbsp;`separator`&nbsp;is&nbsp;removed&nbsp;from&nbsp;the&nbsp;string&nbsp;and&nbsp;the&nbsp;substrings&nbsp;are&nbsp;returned&nbsp;in&nbsp;an&nbsp;array.&nbsp;If</span></span></span></div><div class="line"><a name="line745"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`separator`&nbsp;is&nbsp;omitted,&nbsp;the&nbsp;array&nbsp;contains&nbsp;one&nbsp;element&nbsp;consisting&nbsp;of&nbsp;the&nbsp;entire&nbsp;string.</span></span></span></div><div class="line"><a name="line746"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line747"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`separator`&nbsp;is&nbsp;a&nbsp;regular&nbsp;expression&nbsp;that&nbsp;contains&nbsp;capturing&nbsp;parentheses,&nbsp;then&nbsp;each&nbsp;time&nbsp;separator</span></span></span></div><div class="line"><a name="line748"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;matched&nbsp;the&nbsp;results&nbsp;(including&nbsp;any&nbsp;undefined&nbsp;results)&nbsp;of&nbsp;the&nbsp;capturing&nbsp;parentheses&nbsp;are&nbsp;spliced</span></span></span></div><div class="line"><a name="line749"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;into&nbsp;the&nbsp;output&nbsp;array.&nbsp;However,&nbsp;not&nbsp;all&nbsp;browsers&nbsp;support&nbsp;this&nbsp;capability.</span></span></span></div><div class="line"><a name="line750"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line751"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Note:&nbsp;When&nbsp;the&nbsp;string&nbsp;is&nbsp;empty,&nbsp;`split`&nbsp;returns&nbsp;an&nbsp;array&nbsp;containing&nbsp;one&nbsp;empty&nbsp;string,&nbsp;rather&nbsp;than&nbsp;an</span></span></span></div><div class="line"><a name="line752"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;empty&nbsp;array.</span></span></span></div><div class="line"><a name="line753"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line754"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;defines&nbsp;a&nbsp;function&nbsp;that&nbsp;splits&nbsp;a&nbsp;string&nbsp;into&nbsp;an&nbsp;array&nbsp;of&nbsp;strings&nbsp;using&nbsp;the</span></span></span></div><div class="line"><a name="line755"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;specified&nbsp;separator.&nbsp;After&nbsp;splitting&nbsp;the&nbsp;string,&nbsp;the&nbsp;function&nbsp;displays&nbsp;messages&nbsp;indicating&nbsp;the</span></span></span></div><div class="line"><a name="line756"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;original&nbsp;string&nbsp;(before&nbsp;the&nbsp;split),&nbsp;the&nbsp;separator&nbsp;used,&nbsp;the&nbsp;number&nbsp;of&nbsp;elements&nbsp;in&nbsp;the&nbsp;array,&nbsp;and&nbsp;the</span></span></span></div><div class="line"><a name="line757"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;individual&nbsp;array&nbsp;elements.</span></span></span></div><div class="line"><a name="line758"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line759"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;splitString(stringToSplit,separator)</span></span></span></div><div class="line"><a name="line760"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></span></span></div><div class="line"><a name="line761"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;arrayOfStrings&nbsp;=&nbsp;stringToSplit.split(separator);</span></span></span></div><div class="line"><a name="line762"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&#39;The&nbsp;original&nbsp;string&nbsp;is:&nbsp;&quot;&#39;&nbsp;+&nbsp;stringToSplit&nbsp;+&nbsp;&#39;&quot;&#39;);</span></span></span></div><div class="line"><a name="line763"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&#39;The&nbsp;separator&nbsp;is:&nbsp;&quot;&#39;&nbsp;+&nbsp;separator&nbsp;+&nbsp;&#39;&quot;&#39;);</span></span></span></div><div class="line"><a name="line764"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;The&nbsp;array&nbsp;has&nbsp;&quot;&nbsp;+&nbsp;arrayOfStrings.length&nbsp;+&nbsp;&quot;&nbsp;elements:&nbsp;&quot;);</span></span></span></div><div class="line"><a name="line765"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line766"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;i=0;&nbsp;i&nbsp;&lt;&nbsp;arrayOfStrings.length;&nbsp;i++)</span></span></span></div><div class="line"><a name="line767"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(arrayOfStrings[i]&nbsp;+&nbsp;&quot;&nbsp;/&nbsp;&quot;);</span></span></span></div><div class="line"><a name="line768"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line769"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line770"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;tempestString&nbsp;=&nbsp;&quot;Oh&nbsp;brave&nbsp;new&nbsp;world&nbsp;that&nbsp;has&nbsp;such&nbsp;people&nbsp;in&nbsp;it.&quot;;</span></span></span></div><div class="line"><a name="line771"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;monthString&nbsp;=&nbsp;&quot;Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec&quot;;</span></span></span></div><div class="line"><a name="line772"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line773"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;space&nbsp;=&nbsp;&quot;&nbsp;&quot;;</span></span></span></div><div class="line"><a name="line774"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;comma&nbsp;=&nbsp;&quot;,&quot;;</span></span></span></div><div class="line"><a name="line775"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line776"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;splitString(tempestString,&nbsp;space);</span></span></span></div><div class="line"><a name="line777"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;splitString(tempestString);</span></span></span></div><div class="line"><a name="line778"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;splitString(monthString,&nbsp;comma);</span></span></span></div><div class="line"><a name="line779"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line780"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;example&nbsp;produces&nbsp;the&nbsp;following&nbsp;output:</span></span></span></div><div class="line"><a name="line781"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line782"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;original&nbsp;string&nbsp;is:&nbsp;&quot;Oh&nbsp;brave&nbsp;new&nbsp;world&nbsp;that&nbsp;has&nbsp;such&nbsp;people&nbsp;in&nbsp;it.&quot;</span></span></span></div><div class="line"><a name="line783"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;separator&nbsp;is:&nbsp;&quot;&nbsp;&quot;</span></span></span></div><div class="line"><a name="line784"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;array&nbsp;has&nbsp;10&nbsp;elements:&nbsp;Oh&nbsp;/&nbsp;brave&nbsp;/&nbsp;new&nbsp;/&nbsp;world&nbsp;/&nbsp;that&nbsp;/&nbsp;has&nbsp;/&nbsp;such&nbsp;/&nbsp;people&nbsp;/&nbsp;in&nbsp;/&nbsp;it.&nbsp;/</span></span></span></div><div class="line"><a name="line785"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line786"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;original&nbsp;string&nbsp;is:&nbsp;&quot;Oh&nbsp;brave&nbsp;new&nbsp;world&nbsp;that&nbsp;has&nbsp;such&nbsp;people&nbsp;in&nbsp;it.&quot;</span></span></span></div><div class="line"><a name="line787"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;separator&nbsp;is:&nbsp;&quot;undefined&quot;</span></span></span></div><div class="line"><a name="line788"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;array&nbsp;has&nbsp;1&nbsp;elements:&nbsp;Oh&nbsp;brave&nbsp;new&nbsp;world&nbsp;that&nbsp;has&nbsp;such&nbsp;people&nbsp;in&nbsp;it.&nbsp;/</span></span></span></div><div class="line"><a name="line789"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line790"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;original&nbsp;string&nbsp;is:&nbsp;&quot;Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec&quot;</span></span></span></div><div class="line"><a name="line791"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;separator&nbsp;is:&nbsp;&quot;,&quot;</span></span></span></div><div class="line"><a name="line792"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;array&nbsp;has&nbsp;12&nbsp;elements:&nbsp;Jan&nbsp;/&nbsp;Feb&nbsp;/&nbsp;Mar&nbsp;/&nbsp;Apr&nbsp;/&nbsp;May&nbsp;/&nbsp;Jun&nbsp;/&nbsp;Jul&nbsp;/&nbsp;Aug&nbsp;/&nbsp;Sep&nbsp;/&nbsp;Oct&nbsp;/&nbsp;Nov&nbsp;/&nbsp;Dec&nbsp;/</span></span></span></div><div class="line"><a name="line793"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line794"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;the&nbsp;following&nbsp;example,&nbsp;`split`&nbsp;looks&nbsp;for&nbsp;0&nbsp;or&nbsp;more&nbsp;spaces&nbsp;followed&nbsp;by&nbsp;a&nbsp;semicolon&nbsp;followed&nbsp;by&nbsp;0</span></span></span></div><div class="line"><a name="line795"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;or&nbsp;more&nbsp;spaces&nbsp;and,&nbsp;when&nbsp;found,&nbsp;removes&nbsp;the&nbsp;spaces&nbsp;from&nbsp;the&nbsp;string.&nbsp;nameList&nbsp;is&nbsp;the&nbsp;array&nbsp;returned</span></span></span></div><div class="line"><a name="line796"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;as&nbsp;a&nbsp;result&nbsp;of&nbsp;split.</span></span></span></div><div class="line"><a name="line797"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line798"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;names&nbsp;=&nbsp;&quot;Harry&nbsp;Trump&nbsp;;Fred&nbsp;Barney;&nbsp;Helen&nbsp;Rigby&nbsp;;&nbsp;Bill&nbsp;Abel&nbsp;;Chris&nbsp;Hand&nbsp;&quot;;</span></span></span></div><div class="line"><a name="line799"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(names);</span></span></span></div><div class="line"><a name="line800"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;re&nbsp;=&nbsp;/\s*;\s*\/;</span></span></span></div><div class="line"><a name="line801"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;nameList&nbsp;=&nbsp;names.split(re);</span></span></span></div><div class="line"><a name="line802"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(nameList);</span></span></span></div><div class="line"><a name="line803"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line804"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;prints&nbsp;two&nbsp;lines;&nbsp;the&nbsp;first&nbsp;line&nbsp;prints&nbsp;the&nbsp;original&nbsp;string,&nbsp;and&nbsp;the&nbsp;second&nbsp;line&nbsp;prints&nbsp;the</span></span></span></div><div class="line"><a name="line805"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;resulting&nbsp;array.</span></span></span></div><div class="line"><a name="line806"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line807"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Harry&nbsp;Trump&nbsp;;Fred&nbsp;Barney;&nbsp;Helen&nbsp;Rigby&nbsp;;&nbsp;Bill&nbsp;Abel&nbsp;;Chris&nbsp;Hand</span></span></span></div><div class="line"><a name="line808"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Harry&nbsp;Trump,Fred&nbsp;Barney,Helen&nbsp;Rigby,Bill&nbsp;Abel,Chris&nbsp;Hand</span></span></span></div><div class="line"><a name="line809"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line810"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;In&nbsp;the&nbsp;following&nbsp;example,&nbsp;split&nbsp;looks&nbsp;for&nbsp;0&nbsp;or&nbsp;more&nbsp;spaces&nbsp;in&nbsp;a&nbsp;string&nbsp;and&nbsp;returns&nbsp;the&nbsp;first&nbsp;3</span></span></span></div><div class="line"><a name="line811"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;splits&nbsp;that&nbsp;it&nbsp;finds.</span></span></span></div><div class="line"><a name="line812"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line813"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myString&nbsp;=&nbsp;&quot;Hello&nbsp;World.&nbsp;How&nbsp;are&nbsp;you&nbsp;doing?&quot;;</span></span></span></div><div class="line"><a name="line814"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;splits&nbsp;=&nbsp;myString.split(&quot;&nbsp;&quot;,&nbsp;3);</span></span></span></div><div class="line"><a name="line815"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(splits);</span></span></span></div><div class="line"><a name="line816"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line817"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;script&nbsp;displays&nbsp;the&nbsp;following:</span></span></span></div><div class="line"><a name="line818"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line819"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hello,World.,How</span></span></span></div><div class="line"><a name="line820"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line821"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`separator`&nbsp;contains&nbsp;capturing&nbsp;parentheses,&nbsp;matched&nbsp;results&nbsp;are&nbsp;returned&nbsp;in&nbsp;the&nbsp;array.</span></span></span></div><div class="line"><a name="line822"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line823"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;myString&nbsp;=&nbsp;&quot;Hello&nbsp;1&nbsp;word.&nbsp;Sentence&nbsp;number&nbsp;2.&quot;;</span></span></span></div><div class="line"><a name="line824"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;splits&nbsp;=&nbsp;myString.split(/(\d)/);</span></span></span></div><div class="line"><a name="line825"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(splits);</span></span></span></div><div class="line"><a name="line826"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line827"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;script&nbsp;displays&nbsp;the&nbsp;following:</span></span></span></div><div class="line"><a name="line828"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line829"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hello&nbsp;,1,&nbsp;word.&nbsp;Sentence&nbsp;number&nbsp;,2,&nbsp;.</span></span></span></div><div class="line"><a name="line830"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line831"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>seperator</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Specifies&nbsp;the&nbsp;character&nbsp;to&nbsp;use&nbsp;for&nbsp;separating&nbsp;the&nbsp;string.&nbsp;The&nbsp;separator&nbsp;is&nbsp;treated&nbsp;as&nbsp;a&nbsp;string&nbsp;or&nbsp;a</span></span></span></span></span></div><div class="line"><a name="line832"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;regular&nbsp;expression.&nbsp;If&nbsp;separator&nbsp;is&nbsp;omitted,&nbsp;the&nbsp;array&nbsp;returned&nbsp;contains&nbsp;one&nbsp;element&nbsp;consisting&nbsp;of&nbsp;the&nbsp;entire&nbsp;string.</span></span></span></div><div class="line"><a name="line833"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>limit</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Integer&nbsp;specifying&nbsp;a&nbsp;limit&nbsp;on&nbsp;the&nbsp;number&nbsp;of&nbsp;splits&nbsp;to&nbsp;be&nbsp;found.&nbsp;&nbsp;The&nbsp;split&nbsp;method&nbsp;still&nbsp;splits&nbsp;on&nbsp;every</span></span></span></span></span></div><div class="line"><a name="line834"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;match&nbsp;of&nbsp;separator,&nbsp;but&nbsp;it&nbsp;truncates&nbsp;the&nbsp;returned&nbsp;array&nbsp;to&nbsp;at&nbsp;most&nbsp;limit&nbsp;elements.</span></span></span></div><div class="line"><a name="line835"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Array}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Substrings</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>are&nbsp;returned&nbsp;in&nbsp;an&nbsp;array.</span></span></span></span></span></div><div class="line"><a name="line836"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line837"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line838"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line839"><a name="String-method-substr"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;substr</span></span></span></div><div class="line"><a name="line840"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;characters&nbsp;in&nbsp;a&nbsp;string&nbsp;beginning&nbsp;at&nbsp;the&nbsp;specified&nbsp;location&nbsp;through&nbsp;the&nbsp;specified&nbsp;number</span></span></span></div><div class="line"><a name="line841"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;of&nbsp;characters.</span></span></span></div><div class="line"><a name="line842"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line843"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`start`&nbsp;is&nbsp;a&nbsp;character&nbsp;index.&nbsp;The&nbsp;index&nbsp;of&nbsp;the&nbsp;first&nbsp;character&nbsp;is&nbsp;0,&nbsp;and&nbsp;the&nbsp;index&nbsp;of&nbsp;the&nbsp;last</span></span></span></div><div class="line"><a name="line844"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;character&nbsp;is&nbsp;1&nbsp;less&nbsp;than&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.&nbsp;`substr`&nbsp;begins&nbsp;extracting&nbsp;characters&nbsp;at&nbsp;start</span></span></span></div><div class="line"><a name="line845"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;and&nbsp;collects&nbsp;length&nbsp;characters&nbsp;(unless&nbsp;it&nbsp;reaches&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;string&nbsp;first,&nbsp;in&nbsp;which&nbsp;case&nbsp;it&nbsp;will</span></span></span></div><div class="line"><a name="line846"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;return&nbsp;fewer).</span></span></span></div><div class="line"><a name="line847"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line848"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`start`&nbsp;is&nbsp;positive&nbsp;and&nbsp;is&nbsp;greater&nbsp;than&nbsp;or&nbsp;equal&nbsp;to&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string,&nbsp;`substr`&nbsp;returns&nbsp;an</span></span></span></div><div class="line"><a name="line849"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;empty&nbsp;string.</span></span></span></div><div class="line"><a name="line850"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line851"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`start`&nbsp;is&nbsp;negative,&nbsp;`substr`&nbsp;uses&nbsp;it&nbsp;as&nbsp;a&nbsp;character&nbsp;index&nbsp;from&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;string.&nbsp;If&nbsp;start</span></span></span></div><div class="line"><a name="line852"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;is&nbsp;negative&nbsp;and&nbsp;abs(start)&nbsp;is&nbsp;larger&nbsp;than&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string,&nbsp;`substr`&nbsp;uses&nbsp;0&nbsp;as&nbsp;the&nbsp;start</span></span></span></div><div class="line"><a name="line853"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;index.&nbsp;Note:&nbsp;the&nbsp;described&nbsp;handling&nbsp;of&nbsp;negative&nbsp;values&nbsp;of&nbsp;the&nbsp;start&nbsp;argument&nbsp;is&nbsp;not&nbsp;supported&nbsp;by</span></span></span></div><div class="line"><a name="line854"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Microsoft&nbsp;JScript.</span></span></span></div><div class="line"><a name="line855"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line856"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;length&nbsp;is&nbsp;0&nbsp;or&nbsp;negative,&nbsp;`substr`&nbsp;returns&nbsp;an&nbsp;empty&nbsp;string.&nbsp;If&nbsp;length&nbsp;is&nbsp;omitted,&nbsp;`substr`</span></span></span></div><div class="line"><a name="line857"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;extracts&nbsp;characters&nbsp;to&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line858"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line859"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Consider&nbsp;the&nbsp;following&nbsp;script:</span></span></span></div><div class="line"><a name="line860"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line861"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;a&nbsp;print&nbsp;function&nbsp;is&nbsp;defined</span></span></span></div><div class="line"><a name="line862"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;str&nbsp;=&nbsp;&quot;abcdefghij&quot;;</span></span></span></div><div class="line"><a name="line863"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;(1,2):&nbsp;&quot;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;str.substr(1,2));</span></span></span></div><div class="line"><a name="line864"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;(-3,2):&nbsp;&quot;&nbsp;&nbsp;&nbsp;+&nbsp;str.substr(-3,2));</span></span></span></div><div class="line"><a name="line865"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;(-3):&nbsp;&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;str.substr(-3));</span></span></span></div><div class="line"><a name="line866"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;(1):&nbsp;&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;str.substr(1));</span></span></span></div><div class="line"><a name="line867"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;(-20,&nbsp;2):&nbsp;&quot;&nbsp;+&nbsp;str.substr(-20,2));</span></span></span></div><div class="line"><a name="line868"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;(20,&nbsp;2):&nbsp;&quot;&nbsp;&nbsp;+&nbsp;str.substr(20,2));</span></span></span></div><div class="line"><a name="line869"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line870"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;script&nbsp;displays:</span></span></span></div><div class="line"><a name="line871"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line872"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1,2):&nbsp;bc</span></span></span></div><div class="line"><a name="line873"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(-3,2):&nbsp;hi</span></span></span></div><div class="line"><a name="line874"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(-3):&nbsp;hij</span></span></span></div><div class="line"><a name="line875"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1):&nbsp;bcdefghij</span></span></span></div><div class="line"><a name="line876"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(-20,&nbsp;2):&nbsp;ab</span></span></span></div><div class="line"><a name="line877"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(20,&nbsp;2):</span></span></span></div><div class="line"><a name="line878"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line879"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>start</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>Location&nbsp;at&nbsp;which&nbsp;to&nbsp;begin&nbsp;extracting&nbsp;characters.</span></span></span></span></span></div><div class="line"><a name="line880"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>length</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>The&nbsp;number&nbsp;of&nbsp;characters&nbsp;to&nbsp;extract.</span></span></span></span></span></div><div class="line"><a name="line881"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Modified</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>string.</span></span></span></span></span></div><div class="line"><a name="line882"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line883"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line884"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line885"><a name="String-method-substring"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;substring</span></span></span></div><div class="line"><a name="line886"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;characters&nbsp;in&nbsp;a&nbsp;string&nbsp;between&nbsp;two&nbsp;indexes&nbsp;into&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line887"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line888"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;substring&nbsp;extracts&nbsp;characters&nbsp;from&nbsp;indexA&nbsp;up&nbsp;to&nbsp;but&nbsp;not&nbsp;including&nbsp;indexB.&nbsp;In&nbsp;particular:</span></span></span></div><div class="line"><a name="line889"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;If&nbsp;`indexA`&nbsp;equals&nbsp;`indexB`,&nbsp;`substring`&nbsp;returns&nbsp;an&nbsp;empty&nbsp;string.</span></span></span></div><div class="line"><a name="line890"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;If&nbsp;`indexB`&nbsp;is&nbsp;omitted,&nbsp;substring&nbsp;extracts&nbsp;characters&nbsp;to&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line891"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;If&nbsp;either&nbsp;argument&nbsp;is&nbsp;less&nbsp;than&nbsp;0&nbsp;or&nbsp;is&nbsp;`NaN`,&nbsp;it&nbsp;is&nbsp;treated&nbsp;as&nbsp;if&nbsp;it&nbsp;were&nbsp;0.</span></span></span></div><div class="line"><a name="line892"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;*&nbsp;&nbsp;&nbsp;If&nbsp;either&nbsp;argument&nbsp;is&nbsp;greater&nbsp;than&nbsp;`stringName.length`,&nbsp;it&nbsp;is&nbsp;treated&nbsp;as&nbsp;if&nbsp;it&nbsp;were</span></span></span></div><div class="line"><a name="line893"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`stringName.length`.</span></span></span></div><div class="line"><a name="line894"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line895"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;If&nbsp;`indexA`&nbsp;is&nbsp;larger&nbsp;than&nbsp;`indexB`,&nbsp;then&nbsp;the&nbsp;effect&nbsp;of&nbsp;substring&nbsp;is&nbsp;as&nbsp;if&nbsp;the&nbsp;two&nbsp;arguments&nbsp;were</span></span></span></div><div class="line"><a name="line896"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;swapped;&nbsp;for&nbsp;example,&nbsp;`str.substring(1,&nbsp;0)&nbsp;==&nbsp;str.substring(0,&nbsp;1)`.</span></span></span></div><div class="line"><a name="line897"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line898"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;uses&nbsp;substring&nbsp;to&nbsp;display&nbsp;characters&nbsp;from&nbsp;the&nbsp;string&nbsp;&quot;Sencha&quot;:</span></span></span></div><div class="line"><a name="line899"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line900"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;a&nbsp;print&nbsp;function&nbsp;is&nbsp;defined</span></span></span></div><div class="line"><a name="line901"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;anyString&nbsp;=&nbsp;&quot;Sencha&quot;;</span></span></span></div><div class="line"><a name="line902"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line903"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;&quot;Sen&quot;</span></span></span></div><div class="line"><a name="line904"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(anyString.substring(0,3));</span></span></span></div><div class="line"><a name="line905"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(anyString.substring(3,0));</span></span></span></div><div class="line"><a name="line906"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line907"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;&quot;cha&quot;</span></span></span></div><div class="line"><a name="line908"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(anyString.substring(3,6));</span></span></span></div><div class="line"><a name="line909"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(anyString.substring(6,3));</span></span></span></div><div class="line"><a name="line910"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line911"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;&quot;Sencha&quot;</span></span></span></div><div class="line"><a name="line912"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(anyString.substring(0,6));</span></span></span></div><div class="line"><a name="line913"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(anyString.substring(0,10));</span></span></span></div><div class="line"><a name="line914"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line915"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;replaces&nbsp;a&nbsp;substring&nbsp;within&nbsp;a&nbsp;string.&nbsp;It&nbsp;will&nbsp;replace&nbsp;both&nbsp;individual</span></span></span></div><div class="line"><a name="line916"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;characters&nbsp;and&nbsp;`substrings`.&nbsp;The&nbsp;function&nbsp;call&nbsp;at&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;example&nbsp;changes&nbsp;the&nbsp;string&nbsp;&quot;Brave</span></span></span></div><div class="line"><a name="line917"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;New&nbsp;World&quot;&nbsp;into&nbsp;&quot;Brave&nbsp;New&nbsp;Web&quot;.</span></span></span></div><div class="line"><a name="line918"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line919"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;replaceString(oldS,&nbsp;newS,&nbsp;fullS)&nbsp;{</span></span></span></div><div class="line"><a name="line920"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Replaces&nbsp;oldS&nbsp;with&nbsp;newS&nbsp;in&nbsp;the&nbsp;string&nbsp;fullS</span></span></span></div><div class="line"><a name="line921"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;fullS.length;&nbsp;i++)&nbsp;{</span></span></span></div><div class="line"><a name="line922"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(fullS.substring(i,&nbsp;i&nbsp;+&nbsp;oldS.length)&nbsp;==&nbsp;oldS)&nbsp;{</span></span></span></div><div class="line"><a name="line923"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fullS&nbsp;=&nbsp;fullS.substring(0,&nbsp;i)&nbsp;+&nbsp;newS&nbsp;+&nbsp;fullS.substring(i&nbsp;+&nbsp;oldS.length,</span></span></span></div><div class="line"><a name="line924"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;fullS.length);</span></span></span></div><div class="line"><a name="line925"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line926"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line927"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;fullS;</span></span></span></div><div class="line"><a name="line928"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></span></div><div class="line"><a name="line929"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line930"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replaceString(&quot;World&quot;,&nbsp;&quot;Web&quot;,&nbsp;&quot;Brave&nbsp;New&nbsp;World&quot;);</span></span></span></div><div class="line"><a name="line931"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line932"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>indexA</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>An&nbsp;integer&nbsp;between&nbsp;0&nbsp;and&nbsp;one&nbsp;less&nbsp;than&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.</span></span></span></span></span></div><div class="line"><a name="line933"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@param</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{Number}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>indexB</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>(optional)&nbsp;An&nbsp;integer&nbsp;between&nbsp;0&nbsp;and&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;string.</span></span></span></span></span></div><div class="line"><a name="line934"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Returns</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>the&nbsp;characters&nbsp;in&nbsp;a&nbsp;string&nbsp;between&nbsp;two&nbsp;indexes&nbsp;into&nbsp;the&nbsp;string.</span></span></span></span></span></div><div class="line"><a name="line935"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line936"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line937"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line938"><a name="String-method-toLocaleLowerCase"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;toLocaleLowerCase</span></span></span></div><div class="line"><a name="line939"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;characters&nbsp;within&nbsp;a&nbsp;string&nbsp;are&nbsp;converted&nbsp;to&nbsp;lower&nbsp;case&nbsp;while&nbsp;respecting&nbsp;the&nbsp;current&nbsp;locale.&nbsp;For</span></span></span></div><div class="line"><a name="line940"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;most&nbsp;languages,&nbsp;this&nbsp;will&nbsp;return&nbsp;the&nbsp;same&nbsp;as&nbsp;`toLowerCase`.</span></span></span></div><div class="line"><a name="line941"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line942"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`toLocaleLowerCase`&nbsp;method&nbsp;returns&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string&nbsp;converted&nbsp;to&nbsp;lower&nbsp;case&nbsp;according&nbsp;to</span></span></span></div><div class="line"><a name="line943"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;any&nbsp;locale-specific&nbsp;case&nbsp;mappings.&nbsp;`toLocaleLowerCase`&nbsp;does&nbsp;not&nbsp;affect&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string</span></span></span></div><div class="line"><a name="line944"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;itself.&nbsp;In&nbsp;most&nbsp;cases,&nbsp;this&nbsp;will&nbsp;produce&nbsp;the&nbsp;same&nbsp;result&nbsp;as&nbsp;`toLowerCase()`,&nbsp;but&nbsp;for&nbsp;some&nbsp;locales,</span></span></span></div><div class="line"><a name="line945"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;such&nbsp;as&nbsp;Turkish,&nbsp;whose&nbsp;case&nbsp;mappings&nbsp;do&nbsp;not&nbsp;follow&nbsp;the&nbsp;default&nbsp;case&nbsp;mappings&nbsp;in&nbsp;Unicode,&nbsp;there&nbsp;may</span></span></span></div><div class="line"><a name="line946"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;be&nbsp;a&nbsp;different&nbsp;result.</span></span></span></div><div class="line"><a name="line947"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line948"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;displays&nbsp;the&nbsp;string&nbsp;&quot;sencha&quot;:</span></span></span></div><div class="line"><a name="line949"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line950"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;upperText=&quot;SENCHA&quot;;</span></span></span></div><div class="line"><a name="line951"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(upperText.toLocaleLowerCase());</span></span></span></div><div class="line"><a name="line952"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line953"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Returns</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>value&nbsp;of&nbsp;the&nbsp;string&nbsp;in&nbsp;lowercase.</span></span></span></span></span></div><div class="line"><a name="line954"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line955"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line956"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line957"><a name="String-method-toLocaleUpperCase"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;toLocaleUpperCase</span></span></span></div><div class="line"><a name="line958"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;characters&nbsp;within&nbsp;a&nbsp;string&nbsp;are&nbsp;converted&nbsp;to&nbsp;upper&nbsp;case&nbsp;while&nbsp;respecting&nbsp;the&nbsp;current&nbsp;locale.&nbsp;For</span></span></span></div><div class="line"><a name="line959"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;most&nbsp;languages,&nbsp;this&nbsp;will&nbsp;return&nbsp;the&nbsp;same&nbsp;as&nbsp;`toUpperCase`.</span></span></span></div><div class="line"><a name="line960"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line961"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`toLocaleUpperCase`&nbsp;method&nbsp;returns&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string&nbsp;converted&nbsp;to&nbsp;upper&nbsp;case&nbsp;according&nbsp;to</span></span></span></div><div class="line"><a name="line962"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;any&nbsp;locale-specific&nbsp;case&nbsp;mappings.&nbsp;`toLocaleUpperCase`&nbsp;does&nbsp;not&nbsp;affect&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string</span></span></span></div><div class="line"><a name="line963"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;itself.&nbsp;In&nbsp;most&nbsp;cases,&nbsp;this&nbsp;will&nbsp;produce&nbsp;the&nbsp;same&nbsp;result&nbsp;as&nbsp;`toUpperCase()`,&nbsp;but&nbsp;for&nbsp;some&nbsp;locales,</span></span></span></div><div class="line"><a name="line964"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;such&nbsp;as&nbsp;Turkish,&nbsp;whose&nbsp;case&nbsp;mappings&nbsp;do&nbsp;not&nbsp;follow&nbsp;the&nbsp;default&nbsp;case&nbsp;mappings&nbsp;in&nbsp;Unicode,&nbsp;there&nbsp;may</span></span></span></div><div class="line"><a name="line965"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;be&nbsp;a&nbsp;different&nbsp;result.</span></span></span></div><div class="line"><a name="line966"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line967"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;displays&nbsp;the&nbsp;string&nbsp;&quot;SENCHA&quot;:</span></span></span></div><div class="line"><a name="line968"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line969"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;lowerText=&quot;sencha&quot;;</span></span></span></div><div class="line"><a name="line970"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(lowerText.toLocaleUpperCase());</span></span></span></div><div class="line"><a name="line971"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line972"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Returns</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>value&nbsp;of&nbsp;the&nbsp;string&nbsp;in&nbsp;uppercase.</span></span></span></span></span></div><div class="line"><a name="line973"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line974"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line975"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line976"><a name="String-method-toLowerCase"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;toLowerCase</span></span></span></div><div class="line"><a name="line977"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;calling&nbsp;string&nbsp;value&nbsp;converted&nbsp;to&nbsp;lower&nbsp;case.</span></span></span></div><div class="line"><a name="line978"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line979"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`toLowerCase`&nbsp;method&nbsp;returns&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string&nbsp;converted&nbsp;to&nbsp;lowercase.&nbsp;`toLowerCase`&nbsp;does</span></span></span></div><div class="line"><a name="line980"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;not&nbsp;affect&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string&nbsp;itself.</span></span></span></div><div class="line"><a name="line981"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line982"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;displays&nbsp;the&nbsp;lowercase&nbsp;string&nbsp;&quot;sencha&quot;:</span></span></span></div><div class="line"><a name="line983"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line984"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;upperText=&quot;SENCHA&quot;;</span></span></span></div><div class="line"><a name="line985"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(upperText.toLowerCase());</span></span></span></div><div class="line"><a name="line986"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line987"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Returns</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>value&nbsp;of&nbsp;the&nbsp;string&nbsp;in&nbsp;lowercase.</span></span></span></span></span></div><div class="line"><a name="line988"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line989"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line990"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line991"><a name="String-method-toString"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;toString</span></span></span></div><div class="line"><a name="line992"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;a&nbsp;string&nbsp;representing&nbsp;the&nbsp;specified&nbsp;object.&nbsp;Overrides&nbsp;the&nbsp;`Object.toString`&nbsp;method.</span></span></span></div><div class="line"><a name="line993"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line994"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`String`&nbsp;object&nbsp;overrides&nbsp;the&nbsp;`toString`&nbsp;method&nbsp;of&nbsp;the&nbsp;`Object`&nbsp;object;&nbsp;it&nbsp;does&nbsp;not&nbsp;inherit</span></span></span></div><div class="line"><a name="line995"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;`Object.toString`.&nbsp;For&nbsp;`String`&nbsp;objects,&nbsp;the&nbsp;`toString`&nbsp;method&nbsp;returns&nbsp;a&nbsp;string&nbsp;representation&nbsp;of</span></span></span></div><div class="line"><a name="line996"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;the&nbsp;object.</span></span></span></div><div class="line"><a name="line997"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line998"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;displays&nbsp;the&nbsp;string&nbsp;value&nbsp;of&nbsp;a&nbsp;String&nbsp;object:</span></span></span></div><div class="line"><a name="line999"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1000"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x&nbsp;=&nbsp;new&nbsp;String(&quot;Hello&nbsp;world&quot;);</span></span></span></div><div class="line"><a name="line1001"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(x.toString())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;&quot;Hello&nbsp;world&quot;</span></span></span></div><div class="line"><a name="line1002"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1003"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>A</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>string&nbsp;representation&nbsp;of&nbsp;the&nbsp;object.</span></span></span></span></span></div><div class="line"><a name="line1004"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line1005"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line1006"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line1007"><a name="String-method-toUpperCase"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;toUpperCase</span></span></span></div><div class="line"><a name="line1008"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;calling&nbsp;string&nbsp;value&nbsp;converted&nbsp;to&nbsp;uppercase.</span></span></span></div><div class="line"><a name="line1009"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1010"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`toUpperCase`&nbsp;method&nbsp;returns&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string&nbsp;converted&nbsp;to&nbsp;uppercase.&nbsp;`toUpperCase`&nbsp;does</span></span></span></div><div class="line"><a name="line1011"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;not&nbsp;affect&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string&nbsp;itself.</span></span></span></div><div class="line"><a name="line1012"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1013"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;displays&nbsp;the&nbsp;string&nbsp;&quot;SENCHA&quot;:</span></span></span></div><div class="line"><a name="line1014"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span></span></span></div><div class="line"><a name="line1015"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;lowerText=&quot;sencha&quot;;</span></span></span></div><div class="line"><a name="line1016"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(lowerText.toUpperCase());</span></span></span></div><div class="line"><a name="line1017"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1018"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Returns</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>value&nbsp;of&nbsp;the&nbsp;string&nbsp;in&nbsp;uppercase.</span></span></span></span></span></div><div class="line"><a name="line1019"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line1020"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line1021"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line1022"><a name="String-method-valueOf"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;valueOf</span></span></span></div><div class="line"><a name="line1023"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Returns&nbsp;the&nbsp;primitive&nbsp;value&nbsp;of&nbsp;the&nbsp;specified&nbsp;object.&nbsp;Overrides&nbsp;the&nbsp;`Object.valueOf`&nbsp;method.</span></span></span></div><div class="line"><a name="line1024"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1025"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;`valueOf`&nbsp;method&nbsp;of&nbsp;String&nbsp;returns&nbsp;the&nbsp;primitive&nbsp;value&nbsp;of&nbsp;a&nbsp;`String`&nbsp;object&nbsp;as&nbsp;a&nbsp;string&nbsp;data</span></span></span></div><div class="line"><a name="line1026"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;type.&nbsp;This&nbsp;value&nbsp;is&nbsp;equivalent&nbsp;to&nbsp;`String.toString`.</span></span></span></div><div class="line"><a name="line1027"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1028"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;This&nbsp;method&nbsp;is&nbsp;usually&nbsp;called&nbsp;internally&nbsp;by&nbsp;JavaScript&nbsp;and&nbsp;not&nbsp;explicitly&nbsp;in&nbsp;code.</span></span></span></div><div class="line"><a name="line1029"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1030"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x&nbsp;=&nbsp;new&nbsp;String(&quot;Hello&nbsp;world&quot;);</span></span></span></div><div class="line"><a name="line1031"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(x.valueOf())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Displays&nbsp;&quot;Hello&nbsp;world&quot;</span></span></span></div><div class="line"><a name="line1032"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1033"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>Returns</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>value&nbsp;of&nbsp;string.</span></span></span></span></span></div><div class="line"><a name="line1034"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div><div class="line"><a name="line1035"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line1036"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>&nbsp;ECMAScript&nbsp;5&nbsp;methods</span><span>&nbsp;</span></span></span></div><div class="line"><a name="line1037"><span class="source js"><span>&nbsp;</span></span></div><div class="line"><a name="line1038"><span class="source js"><span class="comment block documentation js"><span class="punctuation definition comment js"><span>/**</span></span></span></span></div><div class="line"><a name="line1039"><a name="String-method-trim"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@method</span></span><span>&nbsp;trim</span></span></span></div><div class="line"><a name="line1040"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Removes&nbsp;whitespace&nbsp;from&nbsp;both&nbsp;ends&nbsp;of&nbsp;the&nbsp;string.</span></span></span></div><div class="line"><a name="line1041"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1042"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;Does&nbsp;not&nbsp;affect&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;string&nbsp;itself.</span></span></span></div><div class="line"><a name="line1043"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1044"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;The&nbsp;following&nbsp;example&nbsp;displays&nbsp;the&nbsp;lowercase&nbsp;string&nbsp;`&quot;foo&quot;`:</span></span></span></div><div class="line"><a name="line1045"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1046"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;orig&nbsp;=&nbsp;&quot;&nbsp;&nbsp;&nbsp;foo&nbsp;&nbsp;&quot;;</span></span></span></div><div class="line"><a name="line1047"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(orig.trim());</span></span></span></div><div class="line"><a name="line1048"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1049"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;**NOTE:**&nbsp;This&nbsp;method&nbsp;is&nbsp;part&nbsp;of&nbsp;the&nbsp;ECMAScript&nbsp;5&nbsp;standard.</span></span></span></div><div class="line"><a name="line1050"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*</span></span></span></div><div class="line"><a name="line1051"><span class="source js"><span class="comment block documentation js"><span>&nbsp;*&nbsp;</span><span class="storage type class jsdoc"><span>@return</span></span><span>&nbsp;</span><span class="other meta jsdoc"><span class="entity name type instance jsdoc"><span>{String}</span></span><span>&nbsp;</span><span class="variable other jsdoc"><span>A</span></span><span>&nbsp;</span><span class="other description jsdoc"><span>string&nbsp;stripped&nbsp;of&nbsp;whitespace&nbsp;on&nbsp;both&nbsp;ends.</span></span></span></span></span></div><div class="line"><a name="line1052"><span class="source js"><span class="comment block documentation js"><span>&nbsp;</span><span class="punctuation definition comment js"><span>*/</span></span></span></span></div></pre>
</body>
<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-1396058-28', 'auto');
    ga('send', 'pageview');

</script>
</html>
